Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Please help.. VLookup Macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP Macro? blucajun Excel Worksheet Functions 3 June 30th 08 09:54 PM
Macro - Vlookup orquidea Excel Discussion (Misc queries) 6 May 14th 08 04:42 PM
Vlookup Macro Joey Excel Discussion (Misc queries) 0 April 11th 08 02:36 AM
Vlookup Macro? ctwobits Excel Discussion (Misc queries) 0 December 6th 07 09:42 PM
Need a macro to do what this VLOOKUP does Tim Excel Programming 5 February 12th 04 04:41 PM


All times are GMT +1. The time now is 04:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"