View Single Post
 
Old 07-27-2011, 02:48 PM
primmer3001 primmer3001 is offline Windows 7 32bit Office 2003
Novice
 
Join Date: Jul 2011
Posts: 5
primmer3001 is on a distinguished road
Default Vlookup in VBA for new starter

I need help in creating a macro to do a Vlookup, I'm new at VBA & some assistance is greatly needed. I know how to do it in excel as a formula, but cannot get it to work in VBA. The problem I have is that I'm not using the same cell every time. My coding is as followed:

'Main Log Sheet
'
rownum = Range("'Feedback'!E3").End(xlDown).Row + 1


'Data entered below

Range("'Feedback'!E" & rownum) = "FB" & rownum
Range("'Feedback'!F" & rownum).Formula = "=VLOOKUP(K & rownum,Users!A2:D110, 4, 0)"
Range("'Feedback'!g" & rownum) = Now
Range("'Feedback'!H" & rownum) = txtaccnum.Value

All the rest work except for the Vlookup. I'm adding data into a sheet so the Vlookup will need to be looking at cell column k but a different number everytime & if possible, paste the value rather than the code in column F. Please help!!!!!!!!!!!!
Reply With Quote