Results 1 to 4 of 4
  1. #1
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Selecting Offset Cells (Excel 97 and >)

    Hello Gang

    I need your help with kinda a brain freeze here.

    I have three columns, 1st column I filter and then use <font color=red> .SpecialCells(xlCellTypeVisible).Select </font color=red> to select the cells that I need to work with.
    Except the cells that I really need to work with are in columns 2 and 3.

    I know it is a combination of Offset and Resize, but is there a way to make the selection jump to the two columns I need to work with without looping?

    Something like selecting the same cells in Columns 2 and 3 with out looping.

    Thanks a Million

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Selecting Offset Cells (Excel 97 and >)

    I could not get resize to work with a non-contiguous area. There may be an easier way, but the following should work:

    <pre>Dim oAreas As Areas, oArea As Range
    Set oAreas = Selection.Areas
    oAreas(1).Select
    For Each oArea In oAreas
    Union(Selection, Range(oArea, oArea.Offset(0, 2))).Select
    Next oArea
    </pre>

    Legare Coleman

  3. #3
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Selecting Offset Cells (Excel 97 and >)

    Thanks Legare

    I came up with something of the same, and the problem was actually having these non-contiguous areas and using the resize was the problem. So looping was the only way you can do it.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Selecting Offset Cells (Excel 97 and >)

    Hi Wassim,

    Do it the other way around:

    With Selection
    .Range(.Offset(, 1), .Offset(, 2)).SpecialCells(xlCellTypeVisible).Select
    End With
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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