Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF FUnctions that produce TEXT results | Excel Worksheet Functions | |||
Parseing to produce text only | Excel Worksheet Functions | |||
can excel produce text in a given cell as a result of a boolean operation? | Excel Discussion (Misc queries) | |||
produce a formulate to produce assigned seats for dinner | Excel Worksheet Functions | |||
need some help combining a variable | Excel Programming |