Consulting

Results 1 to 5 of 5

Thread: Vlookup macro not compiling?

  1. #1
    VBAX Newbie
    Joined
    Jul 2005
    Posts
    3
    Location

    Arrow Vlookup macro not compiling?

    '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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Craigm
    '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.

  3. #3
    VBAX Newbie
    Joined
    Jul 2005
    Posts
    3
    Location

    It is open

    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

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Craigm
    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)

  5. #5
    VBAX Newbie
    Joined
    Jul 2005
    Posts
    3
    Location
    Darn your good. Silly WorkBOOK!


    Thanks, Fox One!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •