Producing Documentation

B

Brettly

Hi

I'm hoping that someone has a good solution for a problem that I have.

I need to take a CSV file of consistant columns but variable rows, tha
copy and paste into a worksheet. Then on another worksheet, within th
same workbook, map the first row of cells from the CSV worksheet int
that 'other' worksheet, print the result, then move down to the nex
row (changing the cells that are mapped over) and so on only stoppin
when no more cells of information remain.

Would be grateful for any ideas.

Thanks
 
B

Bernie Deitrick

Brettly,

If your worksheet's first sheet is the sheet that needs to be printed, and
A1 is the anchor cell for where the cells should be mapped, try the macro
below.

HTH,
Bernie
MS Excel MVP

Sub BrettlyPrint()
Dim myRow As Range
Dim mySht As Worksheet

Workbooks.Open Application.GetOpenFilename _
(fileFilter:="CSV Files (*.csv), *.csv")
Sheets(1).Move After:=ThisWorkbook.Worksheets(1)
Set mySht = ActiveSheet
ThisWorkbook.Worksheets(1).Select

For Each myRow In mySht.Range("A1").CurrentRegion.Rows
myRow.Cells.Copy Worksheets(1).Range("A1") 'A1 is the anchor cell for the
mapping
Application.CalculateFull
ActiveSheet.PrintOut
Next myRow
End Sub
 
Top