Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Concatenate two variables (String & Integer)

Hi,

How to use the variable in the following.

Range("A1").Select

Thanks & Regards,

D.V.Sreenivas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Concatenate two variables (String & Integer)

Sreenivas:

try,

Set rng = Range("A1")
rng.Select

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Sreenivas Varadhan" wrote:

Hi,

How to use the variable in the following.

Range("A1").Select

Thanks & Regards,

D.V.Sreenivas

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Concatenate two variables (String & Integer)

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 Dales


"Sreenivas Varadhan" wrote:

Hi,

How to use the variable in the following.

Range("A1").Select

Thanks & Regards,

D.V.Sreenivas

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Concatenate two variables (String & Integer)


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 :

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.

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
Concatenate in a string IntricateFool Excel Worksheet Functions 4 June 7th 06 07:29 PM
ListBox2.AddItem ListBox1.Value becomes a String when being Integer? SIGE Excel Programming 2 March 30th 05 04:26 PM
Declaring variables (Long, String, Integer) and interpretation spe MrT Excel Programming 4 December 12th 04 12:43 PM
Is there a function to convert a string representing an integer i. perin Excel Programming 1 October 6th 04 09:36 PM
how do you concatenate two variables in VBA billabong Excel Programming 1 September 26th 03 12:30 AM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"