• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Insert Blank Rows

sambit

Member
Sir,
I want to insert blank rows as per my requirement for the specific row line item.

For example :- 2 blank row is inserted for the Row line item is 10.
similarly if i want to insert 8 blank row for the Row line item is 12.



Please find attached example file.
 

Attachments

  • Example (Insert Rows).xlsx
    13.2 KB · Views: 7
Here's the code you could use.
Code:
Sub MakeRows()
    Dim lngRowNum As Long
    Dim lngRowCount As Long
    Dim ws As Worksheet
   
    'What sheet are we dealing with?
    Set ws = Worksheets("Question")
   
   
    With ws
        'Load our variables
        lngRowNum = .Range("E2").Value
        lngRowCount = .Range("E3").Value
       
        'Create the rows in right spot
        .Cells(lngRowNum + 1, 1).EntireRow.Resize(lngRowCount).Insert
    End With
       
End Sub
 
Back
Top