Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
the most obvious error to me is that
Workbooks("C:\InvControl.xls"). is illegal. the workbooks collection only contains open workbooks and you index them with the name Workbooks("InvControl.xls") and InvControl.xls must be open. -- Regards, Tom Ogilvy "STEVE BELL" wrote in message news:F26Ie.12604$Bx5.1344@trnddc09... Rich, I can't be sure - but make sure each Set rng is on a single line Set rng1 =Workbooks("C:\InvControl.xls").Worksheets("Ventur e").Range("A10:A60") If you must wrap - use the line continuation "_" Set rng1 = _ Workbooks("C:\InvControl.xls").Worksheets("Venture ").Range("A10:A60") I check this code to see if it worked correctly (notice line continuation) Dim rng1 As Range Set rng1 = Workbooks("book4").Sheets("sheet1").Range("A:B") ' MsgBox WorksheetFunction.VLookup(Workbooks("book2").Sheet s("Sheet1").Range("A1"), _ rng1, 2, False) So instead of Workbooks("C:\InvControl.xls"). use Workbooks("InvControl"). -- steveB Remove "AYN" from email to respond "Rich Foreman" wrote in message ... Thanks Steve, I tried this code, and replaced 'MyBook' with the correct path to the workbook I am working on. I still get the same error as before, which is 'subscript out of range'. I am getting it on these three lines: Set rng1 = Workbooks("C:\InvControl.xls").Worksheets("Venture ").Range("A10:A60") Set rng2 = Workbooks("C:\VRMList.xls").Worksheets("VRM BY NUMBER").Range("B3:C140") Set rng3 = Workbooks("C:\VRMList.xls").Worksheets("VRM BY NUMBER").Range("B:B") Thanks, Rich *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VLOOKUP Macro? | Excel Worksheet Functions | |||
Macro - Vlookup | Excel Discussion (Misc queries) | |||
Vlookup Macro | Excel Discussion (Misc queries) | |||
Vlookup Macro? | Excel Discussion (Misc queries) | |||
Need a macro to do what this VLOOKUP does | Excel Programming |