dpiano1984
New Member
- Joined
- Feb 8, 2013
- Messages
- 14
Hello all,
I've been working on a code for a project I'm working on that will perform a vlookup from one workbook to the next and loop it multiple times until the end of the worksheet I'm working on. I keep getting a a few errors. It almost never works properly so I can't implement the code into my normal daily activity yet. Here is the code that I have written so far:
That's what I have so far. I did notice that I will have to find a way to change Cell A2 each time, as I want vlookup to just reference the column A. Any help would be greatly appreciated.
Cheers
I've been working on a code for a project I'm working on that will perform a vlookup from one workbook to the next and loop it multiple times until the end of the worksheet I'm working on. I keep getting a a few errors. It almost never works properly so I can't implement the code into my normal daily activity yet. Here is the code that I have written so far:
Code:
Dim myfile as string
msgbox("Please select a file you would like to reference")
myfile = application.getopenfilename
Dim index as integer
index = 3
Dim iCell as integer
iCell = 4
Dim aCell as integer
aCell = 2
Do
Do while iCell < 16
Cells(aCell,iCell).formula = "=vlookup(a2,'[myfile]'!C1:O2000,index,false)"
iCell = iCell + 1
index = index + 1
Loop
aCell = aCell + 1
Loop
That's what I have so far. I did notice that I will have to find a way to change Cell A2 each time, as I want vlookup to just reference the column A. Any help would be greatly appreciated.
Cheers
Last edited: