Thread: Why...
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Why...

Looks like you are using the wrong sheet name

Workbooks("User1.xls").Worksheets("Record").Range( "A2")

Rather than

Workbooks("User1.xls").Worksheets("Sheet1").Range( "A2")


if you address the range correctly, it should work. It won't work on a
closed workbook, however.

--
Regards,
Tom Ogilvy



"mattsvai" wrote in
message ...

why is it that for importing data from another spreadsheet this formula
works:

"=[User1.xls]Record!A2"

But,

Workbooks("User1.xls").Worksheets("Sheet1").Range( "A2")

..DOESN'T WORK IN VBA?

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile:

http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=508132