PDA

View Full Version : Trouble with Vlookup in VBA



hitmanwa
02-18-2012, 03:20 PM
Using some code to populate a table.

This works...

Range("C2:C50").FormulaR1C1 = "=TEXT(RC1, ""mmm"")" This does not...

Range("B2:B50").FormulaR1C1 = "=VLOOKUP(RC1,'U:\Acme Plant Efficiencies\ENP - 685\" & Year(Now()) & "\[ENP-685 " & Range("B1").Value & "-Efficiencies 12.xls] & TEXT(RC1, ""mmm"") & '!R1C1:R50C4,4,FALSE)"

In the formula TEXT(RC1, ""mmm"") RC1 refers to a list of dates from Jan 1 to current and is meant to refer to named tabs in another workbook. If I use "Jan", "Feb", etc it works. Otherwise I get the App-Defined or Object-Defined error. Any thoughts?

Thanks in advance,

shrivallabha
02-18-2012, 10:30 PM
Welcome to VBAX.

Please provide cross posting reference:
http://www.mrexcel.com/forum/showthread.php?t=614688

Use macro recorder to get the formula in R1C1 notation and then implement in your code.