Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    California
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cursor Movement with a Macro (Excel 2000/SR1)

    I'm a complete novice at writing macros, but here goes ... What is the syntax to move down 4 rows. For example, I want to insert a row in my spreadsheet then move down 4 rows and insert another row. I want to do this until I come to the end of my spreadsheet. Thank you in advance for your help. <img src=/S/help.gif border=0 alt=help width=23 height=15>
    Thanks,
    Caroline in lala-land

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

    Re: Cursor Movement with a Macro (Excel 2000/SR1)

    The code below should do what you are asking. It assumes that the cell in column A on the last row is not empty. If this is not correct, you will need to tell me how the macro can determine what the last row is.

    <pre>Public Sub InsertRows()
    Dim I As Long, lLastRow As Long
    I = 4
    Do While I < Worksheets("Sheet1").Range("A65536").End(xlUp).Row - 1
    Worksheets("Sheet1").Range("A1").Offset(I, 0).EntireRow.Insert
    I = I + 5
    Loop
    End Sub
    </pre>

    Legare Coleman

  3. #3
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    California
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor Movement with a Macro (Excel 2000/SR1)

    Thank you!
    Thanks,
    Caroline in lala-land

Posting Permissions

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