Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Auto Insert Rows

I need a macro that will insert 3 blank rows between each row i already have
filled. For example:

From:

Customer1
Customer 2
Customer 3

To:
Customer 1


Customer 2


Customer 3

Any help would be appreciated.

Dominique


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Auto Insert Rows

Hi
try the following macro. It tests column A and inserts a blank row if
the values change
Sub insert_rows()
Dim lastrow As Long
Dim row_index As Long

lastrow = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "A").Value < Cells(row_index + 1, "A").Value
Then
Cells(row_index + 1, "A").resize(3,1).EntireRow.Insert
(xlShiftDown)
End If
Next
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


Dominique Feteau wrote:
I need a macro that will insert 3 blank rows between each row i
already have filled. For example:

From:

Customer1
Customer 2
Customer 3

To:
Customer 1


Customer 2


Customer 3

Any help would be appreciated.

Dominique


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Auto Insert Rows

Dominique

assuming you have a header in row 1, try this:

Sub InsertBlankRows()
Dim LastRow As Long
Dim i As Long
Application.ScreenUpdating = False
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For i = LastRow - 1 To 2 Step -1
Range("A" & i).Offset(1, 0).Resize(3, 1).EntireRow.Insert
Next 'i
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"Dominique Feteau" wrote in message
...
I need a macro that will insert 3 blank rows between each row i already

have
filled. For example:

From:

Customer1
Customer 2
Customer 3

To:
Customer 1


Customer 2


Customer 3

Any help would be appreciated.

Dominique




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Insert New Rows Eric Excel Discussion (Misc queries) 1 June 14th 07 03:06 PM
How to auto insert rows in a list of numbers zdek Excel Discussion (Misc queries) 3 June 16th 06 10:19 PM
how to auto insert rows in Excel TanyaG Excel Discussion (Misc queries) 2 July 4th 05 07:58 PM
Auto Insert Rows of Data?? tojo107 Excel Discussion (Misc queries) 2 May 28th 05 09:28 PM
Auto Insert of Rows Gar3th Excel Worksheet Functions 0 January 6th 05 08:33 PM


All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"