question about creating variable from 2 strings

G

Gary Keramidas

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
 
G

Gary Keramidas

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
 
V

Vergel Adriano

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top