View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default for next loop question

I am using the code below to enter a new column in a worksheet and fill the
new column with a value based on the contents in to different cells. This
works fine.

I would like to enter a vlookup formula in column P each time the code
loops. I dont know how to add the vlookup formula in the loop code

Thanks for any help


Sub subtest1()
Dim rang As Range, lngrow As Long, lngcount As Long, ws As Worksheet
Worksheets("Production").Columns(1).Insert
Set ws = Worksheets("Production")
lngrow = ws.Cells(Rows.Count, "B").End(xlUp).Row
rng = lngrow
For Each rng In Range("A1:A" & lngrow)
rng.Value = rng.Offset(0, 1) & rng.Offset(0, 2)


Next rng
End Sub