Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Adding a blank row after a new record changes in excel

I need to add a blank row to excel for every time the customer number
changes. I have a worksheet that contains customer numbers and invoices. So
sometimes I have one customer for one invoice, most of the times, I have one
customer for 5 to 10 invoices. So I need to add a blank row after a customer
number changes. Please help...
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Adding a blank row after a new record changes in excel

Sub InsertRow_At_Change()
'Sandy Mann July 1st, 2007
Dim LastRow As Long
Dim X As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False

For X = LastRow To 3 Step -1
If Cells(X, 1).Value < Cells(X - 1, 1).Value Then
If Cells(X, 1).Value < "" Then
If Cells(X - 1, 1).Value < "" Then
Cells(X, 1).entirerow.Insert Shift:=xlDown
End If
End If
End If
Next X

Application.ScreenUpdating = True
End Sub

Assumes customer numbers are in column A.

Adjust to suit your case.


Gord Dibben MS Excel MVP

On Thu, 7 Aug 2008 16:06:05 -0700, Skyblue
wrote:

I need to add a blank row to excel for every time the customer number
changes. I have a worksheet that contains customer numbers and invoices. So
sometimes I have one customer for one invoice, most of the times, I have one
customer for 5 to 10 invoices. So I need to add a blank row after a customer
number changes. Please help...


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
Adding Blank Cells ? Robert11 New Users to Excel 2 December 7th 07 08:15 PM
Automatically fill blank cell by same as just above record [email protected] Excel Discussion (Misc queries) 2 March 3rd 07 05:24 PM
identify a record that has a blank space in the data in a field. JH Excel Discussion (Misc queries) 5 October 20th 06 04:16 PM
Excel adding blank rows when sorting [email protected] Excel Discussion (Misc queries) 2 September 23rd 06 05:30 PM
automatically insert 8 blank rows between each record Evad Excel Discussion (Misc queries) 1 February 2nd 06 04:35 AM


All times are GMT +1. The time now is 12:39 PM.

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"