Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Combining Text to Produce a Variable Name

I have defined 2 variables AB01 and AB02 as follows:

Dim AB01, AB02 as Range

and mapped them to row ranges using

Set AB01 = Rows("1:100")
Set AB02 = Rows("101:200")

and wish to Select a row group depending on whether the
Application.Caller.Name is "Picture 1" or "Picture 2"... something like the
following (which is not correct but conveys what I'm trying to do):

"AB"+Right(Application.Caller.Name,2).Select

Any ideas on how to achieve the objective above.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Combining Text to Produce a Variable Name

Make a string variable and then use the RANGE() function.

Something like


Dim S1, S2, S3 as String
S1="AB"
S2="Picture 1"
Range(S1 & Right(S2,1)).Select
--
Gary's Student


"VicWestVan" wrote:

I have defined 2 variables AB01 and AB02 as follows:

Dim AB01, AB02 as Range

and mapped them to row ranges using

Set AB01 = Rows("1:100")
Set AB02 = Rows("101:200")

and wish to Select a row group depending on whether the
Application.Caller.Name is "Picture 1" or "Picture 2"... something like the
following (which is not correct but conveys what I'm trying to do):

"AB"+Right(Application.Caller.Name,2).Select

Any ideas on how to achieve the objective above.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Combining Text to Produce a Variable Name

Use an array for the variable
Dim AB0(1 to 2) as Range
Set AB0(1) = Rows("1:100")
Set AB0(2) = Rows("101:200")
AB0(Right(Application.Caller.Name,1)).Select

Also a side note for you, in this statement:
Dim AB01, AB02 as Range

Only AB02 is Dimmed as a Range, to dim both as ranges do this:
Dim AB01 as Range, AB02 as Range

Charles

VicWestVan wrote:
I have defined 2 variables AB01 and AB02 as follows:

Dim AB01, AB02 as Range

and mapped them to row ranges using

Set AB01 = Rows("1:100")
Set AB02 = Rows("101:200")

and wish to Select a row group depending on whether the
Application.Caller.Name is "Picture 1" or "Picture 2"... something like the
following (which is not correct but conveys what I'm trying to do):

"AB"+Right(Application.Caller.Name,2).Select

Any ideas on how to achieve the objective above.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Combining Text to Produce a Variable Name

Thx.... exactly what I needed.

"Die_Another_Day" wrote:

Use an array for the variable
Dim AB0(1 to 2) as Range
Set AB0(1) = Rows("1:100")
Set AB0(2) = Rows("101:200")
AB0(Right(Application.Caller.Name,1)).Select

Also a side note for you, in this statement:
Dim AB01, AB02 as Range

Only AB02 is Dimmed as a Range, to dim both as ranges do this:
Dim AB01 as Range, AB02 as Range

Charles

VicWestVan wrote:
I have defined 2 variables AB01 and AB02 as follows:

Dim AB01, AB02 as Range

and mapped them to row ranges using

Set AB01 = Rows("1:100")
Set AB02 = Rows("101:200")

and wish to Select a row group depending on whether the
Application.Caller.Name is "Picture 1" or "Picture 2"... something like the
following (which is not correct but conveys what I'm trying to do):

"AB"+Right(Application.Caller.Name,2).Select

Any ideas on how to achieve the objective above.



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
IF FUnctions that produce TEXT results Jafferi[_2_] Excel Worksheet Functions 3 April 20th 09 04:32 AM
Parseing to produce text only Mick Barry Excel Worksheet Functions 5 October 17th 07 07:19 AM
can excel produce text in a given cell as a result of a boolean operation? Richard Erlacher Excel Discussion (Misc queries) 5 October 26th 06 09:39 PM
produce a formulate to produce assigned seats for dinner DavidJoss Excel Worksheet Functions 0 October 4th 05 02:29 AM
need some help combining a variable Gary Keramidas[_2_] Excel Programming 7 July 5th 05 02:51 PM


All times are GMT +1. The time now is 05:19 PM.

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"