defining a range using VBA

cmazur71

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

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

santeria

Well-known Member
Joined
Oct 7, 2003
Messages
1,844
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:
 

Dunkay

New Member
Joined
Jan 14, 2004
Messages
3
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.
 

cmazur71

Board Regular
Joined
Aug 7, 2003
Messages
61
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?
 

santeria

Well-known Member
Joined
Oct 7, 2003
Messages
1,844
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)
 

Watch MrExcel Video

Forum statistics

Threads
1,129,553
Messages
5,636,983
Members
416,953
Latest member
broexc

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
Top