+ Reply to Thread
Results 1 to 4 of 4

Concatenate two variables (String & Integer)

  1. #1
    Sreenivas Varadhan
    Guest

    Concatenate two variables (String & Integer)

    Hi,

    How to use the variable in the following.

    Range("A1").Select

    Thanks & Regards,

    D.V.Sreenivas

  2. #2
    chijanzen
    Guest

    RE: 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. #3
    K Dales
    Guest

    RE: 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. #4
    keepITcool
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1