Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Move Down in Sheet: Macro (97 SR2)

    I want to move down x number of spaces in a macro.. any ideas?

    FYI, x=11. 11 spaces, insert row, repeat.. thanks! <img src=/S/help.gif border=0 alt=help width=23 height=15>
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  2. #2
    Star Lounger
    Join Date
    Aug 2001
    Location
    Lebanon/France
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Move Down in Sheet: Macro (97 SR2)

    I'm not sure if I understood correctly your question:
    by "space" do you mean "one row below"?
    If yes, you could try this (in a loop)...

    ActiveCell.Offset(11, 0).Range("A1").Select
    Selection.EntireRow.Insert

  3. #3
    Bervis
    Guest

    Re: Move Down in Sheet: Macro (97 SR2)

    And since you said 'repeat':

    For i = 1 to 10 'change 10 into the number of new rows you want to insert
    ActiveCell.Offset(11, 0).Range("A1").Select
    Selection.EntireRow.Insert
    Next i

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Move Down in Sheet: Macro (97 SR2)

    I'm not sure I understand the problem, but if it's just that you want to insert a certain number of rows then just go

    Range(ActiveCell,ActiveCell.Offset(10)).EntireRow. Insert

    where 10 is number of rows to be inserted minus one

  5. #5
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Move Down in Sheet: Macro (97 SR2)

    When inserting and deleting rows, life is easier if you loop from the bottom up, instead of top down. This is because the row index for a row you haven't "processed" yet changes when you "process" a row above it. By working bottom up, the ones that have yet to be processed stay the same, even as you are adding and/or deleting rows below them.

Posting Permissions

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