PDA

View Full Version : [SOLVED:] Vlookup macro not compiling?



Craigm
07-01-2005, 03:41 AM
'sDistrict = Application.VLOOKUP(ActiveSheet.Cells(i,1),'C:\Reference\[TranMaster.xls]Translator'!BreakDown_Table,2,TRUE" ") '$A$11:$AC$55,2,TRUE)," ")
=================

sDistrict = Application.VLOOKUP(sBreakDown,'C:\Reference\[TranMaster.xls]Translator'!.Range("Breakdown_Table"),2,TRUE" ") '$A$11:$AC$55,2,TRUE)," ")
=================

I cannot get the Vlookup either example above to compile. I get "Expected: Expression at the ' before the 'C:\Reference\..."

I am lost on this one. The macro will run in a cell no problem but in a macro it dies an ugly death!

Thanks for your suggestions! Craigm:banghead:

Bob Phillips
07-01-2005, 04:04 AM
'sDistrict = Application.VLOOKUP(ActiveSheet.Cells(i,1),'C:\Reference\[TranMaster.xls]Translator'!BreakDown_Table,2,TRUE" ") '$A$11:$AC$55,2,TRUE)," ")
=================

sDistrict = Application.VLOOKUP(sBreakDown,'C:\Reference\[TranMaster.xls]Translator'!.Range("Breakdown_Table"),2,TRUE" ") '$A$11:$AC$55,2,TRUE)," ")
=================

I cannot get the Vlookup either example above to compile. I get "Expected: Expression at the ' before the 'C:\Reference\..."

I am lost on this one. The macro will run in a cell no problem but in a macro it dies an ugly death!

As stated elseewhere, Application.VLOOKUP does not work with a c losed workbook. You will need to open it, issue the Application.VLOOKUP, and then close it.

Craigm
07-01-2005, 04:07 AM
The workbook is open. I am not opening it in the code, I manually open it in Excell. Still No Joy!


sDistrict = Application.VLookup("1701-31-0000-301", Workbooks("TranMasterA").Sheets("Translator").Range("A11:C55"), 2, True)

I am trying this and getting a Subscript out of range error?


Thanks,

Craigm:banghead:

Bob Phillips
07-01-2005, 04:31 AM
The workbook is open. I am not opening it in the code, I manually open it in Excell. Still No Joy!


sDistrict = Application.VLookup("1701-31-0000-301", Workbooks("TranMasterA").Sheets("Translator").Range("A11:C55"), 2, True)

I am trying this and getting a Subscript out of range error?


sDistrict = Application.VLookup("1701-31-0000-301", Workbooks("TranMasterA.xls").Sheets("Translator").Range("A11:C55"), 2, True)

Craigm
07-01-2005, 04:35 AM
Darn your good. Silly WorkBOOK!


Thanks, Fox One!