ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Named Ranges in VB (https://www.excelbanter.com/excel-programming/278509-using-named-ranges-vbulletin.html)

Rocky Bryant

Using Named Ranges in VB
 
Hello,

In WkBk1 I have defined a dynamic range dR which points
to cells in WkBk2. Code in Module1 in WkBk1 I want to
Select dR. so I do the following.

Range(dR).Select


but this line seems to be giving me an error. Can you
actually us a Named Range in VB code? And how would I
accomplish this?

thanks for you help,

Rocky

Chip Pearson

Using Named Ranges in VB
 
Rocky,

Enclose the name of the range in quotes. E.g.,

Range("dR").Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Rocky Bryant" wrote in message
...
Hello,

In WkBk1 I have defined a dynamic range dR which points
to cells in WkBk2. Code in Module1 in WkBk1 I want to
Select dR. so I do the following.

Range(dR).Select


but this line seems to be giving me an error. Can you
actually us a Named Range in VB code? And how would I
accomplish this?

thanks for you help,

Rocky




Ron de Bruin

Using Named Ranges in VB
 
Hi Rocky

You can't select a range in a other workbook this way.
First you must make the workbook and the sheet active.

You don't have to select the cells if you wnat to do wht you want maybe?
What do you want to do?

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Rocky Bryant" wrote in message ...
Hello,

In WkBk1 I have defined a dynamic range dR which points
to cells in WkBk2. Code in Module1 in WkBk1 I want to
Select dR. so I do the following.

Range(dR).Select


but this line seems to be giving me an error. Can you
actually us a Named Range in VB code? And how would I
accomplish this?

thanks for you help,

Rocky




Ron de Bruin

Using Named Ranges in VB
 
And see Chip his answer about the " "


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message ...
Hi Rocky

You can't select a range in a other workbook this way.
First you must make the workbook and the sheet active.

You don't have to select the cells if you wnat to do wht you want maybe?
What do you want to do?

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Rocky Bryant" wrote in message ...
Hello,

In WkBk1 I have defined a dynamic range dR which points
to cells in WkBk2. Code in Module1 in WkBk1 I want to
Select dR. so I do the following.

Range(dR).Select


but this line seems to be giving me an error. Can you
actually us a Named Range in VB code? And how would I
accomplish this?

thanks for you help,

Rocky






Jake Marx[_3_]

Using Named Ranges in VB
 
Ron de Bruin wrote:
You can't select a range in a other workbook this way.
First you must make the workbook and the sheet active.


Or you can use Application.Goto to change the selection to a cell in another
worksheet and/or workbook:

Application.Goto Workbooks("other").Sheets(1).Range("C150")

--
Regards,

Jake Marx
www.longhead.com


"Rocky Bryant" wrote in message
...
Hello,

In WkBk1 I have defined a dynamic range dR which points
to cells in WkBk2. Code in Module1 in WkBk1 I want to
Select dR. so I do the following.

Range(dR).Select


but this line seems to be giving me an error. Can you
actually us a Named Range in VB code? And how would I
accomplish this?

thanks for you help,

Rocky




All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com