View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vacation's Over Vacation's Over is offline
external usenet poster
 
Posts: 279
Default Help on Vlookup for Undetermined Range

what does this code do?
what do you want it to do?
what do you mean by undetermined range?

"sylink" wrote:

Am new on macros and need assistance to adjust the macro below for
undetermined ranges

Dim rng As Range
Dim i As Integer

With Worksheets("sheet1")
Set rng = .Range("a2:b8")
End With

For i = 1 To 7
With Worksheets("sheet2") 'assuming the data you want goes to column b
and
'the lookup value is in Column A'
..Cells(1 + i, 2) = Application.WorksheetFunction.VLookup(.Cells(1 + i,
1), rng, 2, 1)
End With

Next i