Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating a VBA variabel from multiple named worksheet ranges


Hi,

I have the following code which creates the VBA variable called VBA_A
from the named range rng_A:

VBA_A = [rng_A]

I have a rng_A for each currency, one per worksheet. Each one refers to
a column matrix and they are not necessarily of the same dimensions. So
for example, I have a range rng_AUSD for the US$ on one worksheet. I
wanted to change the above line to be able to select the correct range
depending on which worksheet I am on. To do this I have entered the
3-letter code for the currency in cell C1 on each worksheet. So I tried
the following:

Dim ccy As String
ccy = ActiveSheet.Range("C1").Value
VBA_A = [rng_A & ccy]

I find this gives me Error 2029. It steps over the code but the data is
not in the variable when I "add to the Watch". Has anyone got any ideas
what's going wrong?

Thanks very much,

ed


--
brachistochrone
------------------------------------------------------------------------
brachistochrone's Profile: http://www.excelforum.com/member.php...o&userid=34274
View this thread: http://www.excelforum.com/showthread...hreadid=547187

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default creating a VBA variabel from multiple named worksheet ranges

Dim ccy As String

ccy = ActiveSheet.Range("C1").Value
VBA_A = Range("rng_A" & ccy).Value



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"brachistochrone"
<brachistochrone.28ops0_1149100203.5993@excelfor um-nospam.com wrote in
message news:brachistochrone.28ops0_1149100203.5993@excelf orum-nospam.com...

Hi,

I have the following code which creates the VBA variable called VBA_A
from the named range rng_A:

VBA_A = [rng_A]

I have a rng_A for each currency, one per worksheet. Each one refers to
a column matrix and they are not necessarily of the same dimensions. So
for example, I have a range rng_AUSD for the US$ on one worksheet. I
wanted to change the above line to be able to select the correct range
depending on which worksheet I am on. To do this I have entered the
3-letter code for the currency in cell C1 on each worksheet. So I tried
the following:

Dim ccy As String
ccy = ActiveSheet.Range("C1").Value
VBA_A = [rng_A & ccy]

I find this gives me Error 2029. It steps over the code but the data is
not in the variable when I "add to the Watch". Has anyone got any ideas
what's going wrong?

Thanks very much,

ed


--
brachistochrone
------------------------------------------------------------------------
brachistochrone's Profile:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating a VBA variabel from multiple named worksheet ranges


Thanks very much. It works!

Ed


--
brachistochrone
------------------------------------------------------------------------
brachistochrone's Profile: http://www.excelforum.com/member.php...o&userid=34274
View this thread: http://www.excelforum.com/showthread...hreadid=547187

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
Creating dynamic ranges which are named. U0107 Excel Worksheet Functions 1 January 5th 10 11:46 PM
getting the sum of variabel ranges Hein Excel Worksheet Functions 4 March 26th 06 07:44 PM
Creating a pivot table using all named ranges excelguru Excel Programming 2 February 29th 04 11:21 AM
Creating dymnamic named ranges John Baker Excel Programming 6 December 4th 03 02:05 PM
Creating Named Ranges in VBA Mark D'Agosta Excel Programming 4 October 4th 03 06:15 AM


All times are GMT +1. The time now is 11:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"