ib175
09-15-2015, 10:49 AM
I am reasonably new to VBA but have put together the following routine to scroll through a list and print each version of the sheet that the loop creates. The list is in column "h".
I do however have different versions of the list in other columns, is there anyway I can get the routine to look up the value in a excel cell to determine what column to use. i.e. Cell A1 has the value "v" in it therefore the routine will use the list in column "v".
Many thanks.
Sub PrintfromDVList()
Dim ws As Worksheet
Dim i As Long
Set ws = Sheets("Team RAW Data")
For i = 1 To ws.Cells(Rows.Count, cell(1, "h")).End(xlUp).Row
If ws.Cells(i, cell(1, "h")).Value = "zzz" Then Exit Sub
With Sheets("AP QTD Trend")
.Range("B1").Value = ws.Cells(i, cell(1, "h")).Value
.PrintOut
End With
Next i
End Sub
I do however have different versions of the list in other columns, is there anyway I can get the routine to look up the value in a excel cell to determine what column to use. i.e. Cell A1 has the value "v" in it therefore the routine will use the list in column "v".
Many thanks.
Sub PrintfromDVList()
Dim ws As Worksheet
Dim i As Long
Set ws = Sheets("Team RAW Data")
For i = 1 To ws.Cells(Rows.Count, cell(1, "h")).End(xlUp).Row
If ws.Cells(i, cell(1, "h")).Value = "zzz" Then Exit Sub
With Sheets("AP QTD Trend")
.Range("B1").Value = ws.Cells(i, cell(1, "h")).Value
.PrintOut
End With
Next i
End Sub