Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Select range from unopened workbook

I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range, I
get the subscript out of range error.

Any ideas?
thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Select range from unopened workbook

Make sure your spelling of the names is accurate. Make sure you actually
have a sheet named BILLRATE in the workbook. As a side note, why not just
use Range("A1") for your cell reference rather than the duplicative Cells(1,
1).Range("A1")? It does the same thing and saves space.


"Andrew" wrote in message
...
I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range, I
get the subscript out of range error.

Any ideas?
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Select range from unopened workbook

hi
the line of code you are using is for open workbooks. to get data from a
closed workbook, you will have to use ADO.
See this site.
http://www.rondebruin.nl/ado.htm


Regards
FSt1

"Andrew" wrote:

I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range, I
get the subscript out of range error.

Any ideas?
thanks
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Select range from unopened workbook

Unless

range("A12").formula="=[BILLRATE.xls].BILLRATE!A1"

-- =[20100201.xls]Sheet1!$E$13

Don Guillett
Microsoft MVP Excel
SalesAid Software

"FSt1" wrote in message
...
hi
the line of code you are using is for open workbooks. to get data from a
closed workbook, you will have to use ADO.
See this site.
http://www.rondebruin.nl/ado.htm


Regards
FSt1

"Andrew" wrote:

I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range, I
get the subscript out of range error.

Any ideas?
thanks
.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Select range from unopened workbook

hi
you are right. but nothing in his post made me think of that.
so i guess i got turned around.

regards
FSt1

"Don Guillett" wrote:

Unless

range("A12").formula="=[BILLRATE.xls].BILLRATE!A1"

-- =[20100201.xls]Sheet1!$E$13

Don Guillett
Microsoft MVP Excel
SalesAid Software

"FSt1" wrote in message
...
hi
the line of code you are using is for open workbooks. to get data from a
closed workbook, you will have to use ADO.
See this site.
http://www.rondebruin.nl/ado.htm


Regards
FSt1

"Andrew" wrote:

I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range, I
get the subscript out of range error.

Any ideas?
thanks
.


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Select range from unopened workbook

but then if the workbook were closed(not opened) excel would insert the
entire file path.

regards
FSt1

"FSt1" wrote:

hi
you are right. but nothing in his post made me think of that.
so i guess i got turned around.

regards
FSt1

"Don Guillett" wrote:

Unless

range("A12").formula="=[BILLRATE.xls].BILLRATE!A1"

-- =[20100201.xls]Sheet1!$E$13

Don Guillett
Microsoft MVP Excel
SalesAid Software

"FSt1" wrote in message
...
hi
the line of code you are using is for open workbooks. to get data from a
closed workbook, you will have to use ADO.
See this site.
http://www.rondebruin.nl/ado.htm


Regards
FSt1

"Andrew" wrote:

I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range, I
get the subscript out of range error.

Any ideas?
thanks
.


.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Select range from unopened workbook

so?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"FSt1" wrote in message
...
but then if the workbook were closed(not opened) excel would insert the
entire file path.

regards
FSt1

"FSt1" wrote:

hi
you are right. but nothing in his post made me think of that.
so i guess i got turned around.

regards
FSt1

"Don Guillett" wrote:

Unless

range("A12").formula="=[BILLRATE.xls].BILLRATE!A1"

-- =[20100201.xls]Sheet1!$E$13

Don Guillett
Microsoft MVP Excel
SalesAid Software

"FSt1" wrote in message
...
hi
the line of code you are using is for open workbooks. to get data
from a
closed workbook, you will have to use ADO.
See this site.
http://www.rondebruin.nl/ado.htm


Regards
FSt1

"Andrew" wrote:

I'm trying to take data from an unopened workbook. I copied the
following code directly from my "Excel 2003 VBA" book.

range("A12") =
Workbooks("BILLRATE.xls").Worksheets("BILLRATE").C ells(1,
1).range("A1")

I get a "subscript out of range error on this. The workbook
"BILLRATE" is in the working folder. And I can call it if I use
Workbooks("BILLRATE.xls").Open. But when I try to access the range,
I
get the subscript out of range error.

Any ideas?
thanks
.


.


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
Referencing Range in UnOpened Workbook Vlado Sveda Excel Programming 7 May 31st 06 09:49 AM
Unopened workbook H. Excel Discussion (Misc queries) 1 May 2nd 06 04:12 PM
Importing Data from unopened Workbook into an open Workbook GrayesGhost Excel Discussion (Misc queries) 0 March 5th 05 11:25 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM
Unopened workbook values Amuel Pouart Excel Programming 3 September 5th 03 04:39 PM


All times are GMT +1. The time now is 01:57 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"