Concatenate two variables (String & Integer)

G

Guest

Hi,

How to use the variable in the following.

Range("A1").Select

Thanks & Regards,

D.V.Sreenivas
 
G

Guest

Do you mean you have a string variable that represents the column ("A") and
an integer variable that represents the row (1)? It would be like this:

Dim ColLtr as String, RowNo as Integer
ColLtr = "A"
RowNo = 1
Range(ColLtr & RowNo).Select

VBA can do the conversion from integer to string when you concatenate with
&. However, in other circumstances you may need to convert to string first
with CStr and make sure it is formatted properly.
 
K

keepITcool

Arghhh...this is asking for trouble...

the RowNo should be defined as a Long
else the code will misbehave above row 32768



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


K Dales wrote :
 

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