Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add loop to Vlookup
Hi all, i have got the following code that i need to loop with can somebody
please show me how to alter the code.... It works great except i need it to loop down all numbers in column A which will be variable in length Sub VLUp() Dim LookUpTable As Range, LookUpCell As Range Dim res As String, myRange As Range Set LookUpTable = Workbooks("PU0907LCS.xls").Worksheets("LCS").Range ("LCS") Set LookUpCell = Workbooks("90IH0709.xls").Worksheets("KTL").Range( "A10") res = Application.VLookup(LookUpCell.Value, LookUpTable, 7, False) ActiveCell = res res = Application.VLookup(LookUpCell.Value, LookUpTable, 2, False) ActiveCell.Offset(0, 2) = res res = Application.VLookup(LookUpCell.Value, LookUpTable, 8, False) ActiveCell.Offset(0, 3) = res End Sub -- Les |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add loop to Vlookup
Les,
There's a few different ways to loop through your active cells. Here's one simple way of doing that..... Dim MyRow as long For MyRow = 1 to Range("A65536").End(xlup).Row 'Put your code in here 'use MyRow as your Row identifier ' For Example Cells(MyRow,1).Value = "Column A of Row MyRow" Next MyRow I hope this points you in the right direction. Allen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
using a vlookup command in a for next loop in a macro in excel | Excel Discussion (Misc queries) | |||
VLOOKUP loop multiple times | Excel Worksheet Functions | |||
Need a vb loop for vlookup | Excel Programming | |||
Need a vb loop for vlookup | Excel Programming | |||
Find & Replace / Loop & Vlookup | Excel Programming |