defining a range using VBA

cmazur71

Board Regular
Joined
Aug 7, 2003
Messages
63
How do I define a range using VBA? The data for the range is located in another workbook that is not opened.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Depends on what you are wanting to do, it seems...

I just checked a bundle of Macros, and the range definition had a wide number of variants...

:unsure:
 
Upvote 0
Hmmm...

Does the workbook have to stay closed?

Is it always in the same location?

I have used something before along the lines of:
Code:
Application.Workbooks.Open ("temp1.xls")
Workbooks("temp1.xls").Worksheets("Sheet1").Activate

'Do some stuff

Activeworkbook.Close

However, this is not very efficient programming as it is slow , going back and forth between workbooks like this!

Hope this is of some use.

Dunkay.
 
Upvote 0
I have a combo box, and the ListFillRange contains a Range (CUST_LIST) which referes to a list in another workbook.
I am trying to defing this range without having to open up the other workbook. Is this possible?
 
Upvote 0
Yes... So long as you have something like a list reference to the Cells, or something comparable ( darn... my workbook with what I used is not here, ah well... someone will no doubt come up with the appropriate linkage)

Actually.... this is one example of how to access a closed book :

http://www.mrexcel.com/board2/viewtopic.php?t=48998&highlight=reference+closed+book


I did something similar... just needs a reference to the Cells in that closed book, usually defining the First Line/row, and subsequent...

(y)
 
Upvote 0

Forum statistics

Threads
1,214,848
Messages
6,121,917
Members
449,055
Latest member
KB13

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top