+ Reply to Thread
Results 1 to 3 of 3

VB Range select issue

  1. #1
    Registered User
    Join Date
    02-25-2005
    Posts
    11

    VB Range select issue

    I've gotten help from Leith earlier with some of this code but I still can't get it to select quite right.

    Here is the code I have now. When I run the macro seperately, one to select the last 20 and then one to select the first 20 it selects those groups. However, I need to select them both simultaneously.

    'Find the Last 20 Rows in Columns A - C
    R = ActiveCell.Row
    x = ActiveSheet.UsedRange.Rows.Count
    LastRange = "A" & (x - 19) & ":C" & x
    ActiveSheet.Range(LastRange).Select

    'Find the First 20 Rows in Columns A - C
    R = ActiveSheet.UsedRange.Row + 2
    FirstRange = "A" & (R) & ":C" & (R + 19)
    ActiveSheet.Range(LastRange, FirstRange).Select

    In the last range select I added both lastrange and firstrange. This doesn't select the first and last 20 it selects the entire sheet. Do you have any ideas to select both the first 20 and last 20 in the same macro?
    Thanks
    WB99

  2. #2
    Forum Contributor
    Join Date
    11-16-2004
    Posts
    282
    Try this instead:
    Please Login or Register  to view this content.
    Hope this helps,
    theDude

  3. #3
    Registered User
    Join Date
    02-25-2005
    Posts
    11
    theDude
    Thanks this works great.
    I really appreciate it.

+ 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