Microsoft
Software
Hardware
Network
Question : macro vlookup error
I am trying to create a macro, whereby it populates certain cells with a vlookup formula. I know the formula works when i manually put the formula into the cell. the vlookup statement i am using is:
=IF(ISNA(VLOOKUP(ReportShe
et!A4,Expe
nsesReceiv
ed!A2:A100
0,1,FALSE)
),FALSE,TR
UE)
the problem is when i put this into my macro, the formula is coming back as
=IF(ISNA(VLOOKUP(ReportShe
et!A4,Expe
nsesReceiv
ed!'A2':'A
1000',1,FA
LSE)),FALS
E,TRUE)
Please note that there are quotes beside the table array cells. The code i am using to assign the vlookup formula to the cell is :
Cells(intCurrentRow, 11).FormulaR1C1 = "=IF(ISNA(VLOOKUP(ReportSh
eet!RC[-10
],Expenses
Received!A
2:A1000,1,
FALSE)),FA
LSE,TRUE)"
I am not putting any quotes beside the cell names, so why is this being caused? Once i run the macro, the vlookup statement is in the correct cells, but does not work. If i manually remove the quotes beside the table array it works? Please can someone help. thanks.
Answer : macro vlookup error
Oops miss the fact that you have mixed the formula type. Change it to this:
Cells(intCurrentRow, 11).FormulaR1C1 = "=IF(ISNA(VLOOKUP(ReportSh
eet!RC[-10
],Expenses
Received!R
[1]C[-12]:
R[999]C[-1
2],1,FALSE
)),FALSE,T
RUE)"
Random Solutions
System Volume Information directory needs purging on Winodws SBS 2003 Server.
Calculated Fields
How to robocopy and remove EFS on destination files
MS Draw in a stand-alone form?
Upgrade from Windows Server 200 to 2007 and impact on security?
Copying Tables in Fox 9
Shell batch file and return values
Retrieving Outlook Archive items with attachments
VB.net program fails when run from a network drive
Convert hyperlinks from '=HYPERLINK()' to 'embedded' links