Solved

Insert rows programatically in excel

Posted on 2013-05-23
2
339 Views
Last Modified: 2013-05-24
On my work sheet I want to insert an empty row after row5  and then an empty row after every row of data until until row 107. is this possible in VBA?
0
Comment
Question by:Serena2345
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 39192545
Yes it is. The easiest is to do a reverse loop so that you start inserting at the end and work your way back up. That way you don't need to address the fact to row 6 is now row7, row 7 is now row 9, etc.

Thomas

Sub FUNNYTETS()
Dim lLoop As Long, rgRows As Range

'turn off updates to speed up code execution
With Application
    .ScreenUpdating = False
    .EnableEvents = False
    .Calculation = xlCalculationManual
    .DisplayAlerts = False
End With


For lLoop = 108 To 6 Step -1

    Rows(lLoop).Insert

Next

'turn off updates to speed up code execution
With Application
    .ScreenUpdating = False
    .EnableEvents = False
    .Calculation = xlCalculationManual
    .DisplayAlerts = False
End With


End Sub

Open in new window

0
 

Author Closing Comment

by:Serena2345
ID: 39195642
just what I needed thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question