Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto insert rows?

Status
Not open for further replies.

robcunliffe

Technical User
Mar 22, 2005
22
GB
Hello,

Using Excel xp. On Windows XP. Excel VBA.

I would like to insert 6 blank rows after each current row.

So if i have data in rows 1 to 1000 i would like to insert 6 blank rows between the current rows.

Can anyone offer any help?

I have a recorded macro that looks like this:

Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Rows("7:7").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown

But i dont think this is the right approach. I think i need a loop of some sort?

Many thanks, any help gratefully appreciated.

Rob Cunliffe
 
Loop from last used row countdown to the 1st.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Many thanks for your quick reply. BUt im a bit unsure what you mean

Could you provide some more details, an idiots type guide?

Many thanks

Rob
 
Use this type of construct
Code:
For i = 2000 to 1 step -1
'do stuff here using "i" as a row number
Next i

search FAQs for ways to get the last used row


Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top