+ Reply to Thread
Results 1 to 5 of 5

select a variable range

  1. #1
    Registered User
    Join Date
    02-27-2006
    Posts
    16

    select a variable range

    I want to select coloums A-BR of different rows in a loop.


    How do I setup the Range (A[some_number]:BR[some_number]).select

    the number will change a few times and wont be the same everytime I run the macro

  2. #2
    Justin Philips
    Guest

    Re: select a variable range

    Something like this but change your do while to what you need.

    Dim x, y As Single

    x = 1
    y = 1

    Do While Range("B" & x).Value <> ""
    Range("A" & x & ":AR" & y).Select
    x = x + 1
    y = y + 1
    Loop


  3. #3
    Jim Thomlinson
    Guest

    RE: select a variable range

    Try something like this

    dim lngThisNumber as long
    dim lngThatNumber as long

    lngThisNumber = 1
    lngThatNumber = 12345

    range(cells(lngThisNumber, "A"), cells(lngThatNumber, "BR").Select
    --
    HTH...

    Jim Thomlinson


    "evil baby" wrote:

    >
    > I want to select coloums A-BR of different rows in a loop.
    >
    >
    > How do I setup the Range (A[some_number]:BR[some_number]).select
    >
    > the number will change a few times and wont be the same everytime I run
    > the macro
    >
    >
    > --
    > evil baby
    > ------------------------------------------------------------------------
    > evil baby's Profile: http://www.excelforum.com/member.php...o&userid=31983
    > View this thread: http://www.excelforum.com/showthread...hreadid=520237
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: select a variable range

    for i = 1 to 20
    cells(i,1).Resize(1,70).Select
    msgbox selection.Address
    Next

    --
    Regards,
    Tom Ogilvy


    "evil baby" <[email protected]> wrote
    in message news:[email protected]...
    >
    > I want to select coloums A-BR of different rows in a loop.
    >
    >
    > How do I setup the Range (A[some_number]:BR[some_number]).select
    >
    > the number will change a few times and wont be the same everytime I run
    > the macro
    >
    >
    > --
    > evil baby
    > ------------------------------------------------------------------------
    > evil baby's Profile:

    http://www.excelforum.com/member.php...o&userid=31983
    > View this thread: http://www.excelforum.com/showthread...hreadid=520237
    >




  5. #5
    Registered User
    Join Date
    02-27-2006
    Posts
    16
    Thanks for the help again

    I ended up using

    Range("A" & x, "L" & x).Select

    and just setting x to activecell

+ 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