Results 1 to 4 of 4

Thread: Selecting a Range

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    46

    Resolved Selecting a Range

    I'm trying to use the following code
    VB Code:
    1. Range("A"&Select1&":BW"Select1&",A8:BW8")

    Where Select1 is an integer, But i cant get it to work can anyone help.
    Last edited by Pearso; Dec 7th, 2005 at 05:14 PM.

  2. #2
    Addicted Member malik641's Avatar
    Join Date
    Sep 2005
    Location
    South Florida :-)
    Posts
    221

    Re: Selecting a Range

    You were missing an Ampersand and the comma should not be in the last range.

    VB Code:
    1. Range("A" & Select1 & ":BW" & Select1 , "A8:BW8")

    Untested...but it should work




    If you find any of my posts of good help, please rate it

  3. #3
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Selecting a Range

    Quote Originally Posted by Pearso
    I'm trying to use the following code
    VB Code:
    1. Range("A"&Select1&":BW"Select1&",A8:BW8")

    Where Select1 is an integer, But i cant get it to work can anyone help.
    Hi,

    You missed the "&" as marked in blue color font in the following code. And also give space between words, variables, etc. If you want to select that range, you need to use the following code:
    VB Code:
    1. Range("A" & select1 & ":BW" [COLOR=Blue]&[/COLOR] select1 & ", A8:BW8").Select
    For example, If the value of select1 is 5 it will select "A5 to BW5" and "A8 to BW8".

    Always give space between variables, ambersand, strings etc.
    ________________
    CS.
    Last edited by cssriraman; Dec 7th, 2005 at 12:20 AM.

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    46

    Re: Selecting a Range

    Thanks,

    It always helps to have a second set of eyes look gs.

Posting Permissions

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



Click Here to Expand Forum to Full Width