+ Reply to Thread
Results 1 to 3 of 3

Adding empty rows, Help!

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    2

    Adding empty rows, Help!

    I am trying to use following macro to insert rows in a spreadsheet:

    Please Login or Register  to view this content.
    it does work, but add rows one by one at every entry
    e.g.
    when I run macro, it adds a row after A2, then a dialog box appears and I have to manually press Ok or close the box then it inserts another line after the next occupied row and so on.
    Is there any way I can add empty rows at once or it automatically goes to next row without pressing anything manually?
    i am very new to Excel, your help will be appreciated.
    Thanks in advance

    Moderators note: code tags added for you - this time
    Last edited by FDibbins; 11-29-2012 at 08:32 PM.

  2. #2
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Adding empty rows, Help!

    PHP Code: 
    Option Explicit
    Sub Insert
    ()
     
    Dim J As LongAs Range

     J 
    InputBox("Number Of Rows To Be Insered")
     
    Set R Range("A2")
     Do
        If 
    R.Offset(10) = "" Then Exit Do
        
    R.Offset(1).Resize(J).EntireRow.Insert
        Set R 
    R.Offset(J)
    '    MsgBox R.Address'   <=|
     
    Loop
    End Sub 

  3. #3
    Registered User
    Join Date
    11-29-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    2

    Re: Adding empty rows, Help!

    Thanks a lot!

+ 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