Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Resizing Selection (03)

    I know one can resize a region by vba based on rows and columns. From what I understand it can be done by either adding/subtracting rows/columns.

    How would it be done if one simply wanted to omit the top row? As an example range("A1:G25") is selected; the end result would be range("A2:G25") being selected.

    Thanks,
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Resizing Selection (03)

    By a combination of Offset and Resize:

    Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Resizing Selection (03)

    Hans,

    Very nice. How about when the same range is the CurrentRegion?

    I came up with:

    Range("A1").CurrentRegion.Offset(1, 0).Resize(CurrentRegion.Rows.Count - 1).Select

    but it errors out looking for an object.

    Regards,
    John

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Resizing Selection (03)

    You forgot to qualify the second instance of CurrentRegion:

    Range("A1").CurrentRegion.Offset(1, 0).Resize(Range("A1").CurrentRegion.Rows.Count - 1).Select

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Resizing Selection (03)

    Thank you.

    Regards,
    John

Posting Permissions

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