ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   question about creating variable from 2 strings (https://www.excelbanter.com/excel-programming/396051-question-about-creating-variable-2-strings.html)

Gary Keramidas

question about creating variable from 2 strings
 
may have asked this before, but can't find it.
is it possible to create a variable from 2 strings and have it return the value?
Simple example, RowColor is Dimmed as Long and has as value of 4
2 strings, one String1 is "Row" the other, String2 is "Color"
join the 2 strings to make "RowColor"

range("A1").interior.colorindex = String1 & String2


--



Gary



Gary Keramidas

question about creating variable from 2 strings
 
went a different route and used select case instead.

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message ...
may have asked this before, but can't find it.
is it possible to create a variable from 2 strings and have it return the value?
Simple example, RowColor is Dimmed as Long and has as value of 4
2 strings, one String1 is "Row" the other, String2 is "Color"
join the 2 strings to make "RowColor"

range("A1").interior.colorindex = String1 & String2


--



Gary



Vergel Adriano

question about creating variable from 2 strings
 
How about putting the values in a collection?

Sub test()
Dim col As New Collection
Dim String1 As String, string2 As String

col.Add 4, "RowColor"
col.Add 12, "RowHeight"

String1 = "Row"
string2 = "Color"

MsgBox col(String1 & string2)

End Sub


--
Hope that helps.

Vergel Adriano


"Gary Keramidas" wrote:

may have asked this before, but can't find it.
is it possible to create a variable from 2 strings and have it return the value?
Simple example, RowColor is Dimmed as Long and has as value of 4
2 strings, one String1 is "Row" the other, String2 is "Color"
join the 2 strings to make "RowColor"

range("A1").interior.colorindex = String1 & String2


--



Gary




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

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