Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default blank row after control break

I am listing customer accounts, sorted by by company#, account. How can I
leave a blank row when there is a break on company# (without creating a
pivot table)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default blank row after control break

How about a macro? Assuming Company # is column A

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


Gord Dibben MS Excel MVP

On Wed, 5 Sep 2007 17:20:00 -0700, GregNga
wrote:

I am listing customer accounts, sorted by by company#, account. How can I
leave a blank row when there is a break on company# (without creating a
pivot table)


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default blank row after control break

how does that work, select the rows/cols and apply the macro against it or
run it on the entire sheet

Thanks

"Gord Dibben" wrote:

How about a macro? Assuming Company # is column A

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


Gord Dibben MS Excel MVP

On Wed, 5 Sep 2007 17:20:00 -0700, GregNga
wrote:

I am listing customer accounts, sorted by by company#, account. How can I
leave a blank row when there is a break on company# (without creating a
pivot table)



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default blank row after control break

You can run it on the entire sheet without any selection.

The code runs through the used range on Column A(1) from the bottom up and
inserts a blank row at any change in Company #


Gord


On Thu, 6 Sep 2007 05:12:04 -0700, GregNga
wrote:

how does that work, select the rows/cols and apply the macro against it or
run it on the entire sheet

Thanks

"Gord Dibben" wrote:

How about a macro? Assuming Company # is column A

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


Gord Dibben MS Excel MVP

On Wed, 5 Sep 2007 17:20:00 -0700, GregNga
wrote:

I am listing customer accounts, sorted by by company#, account. How can I
leave a blank row when there is a break on company# (without creating a
pivot table)




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
Break cell into multiple lines by line break Chia Excel Discussion (Misc queries) 1 August 20th 06 06:37 AM
spinner format control has no control tab AJ Excel Worksheet Functions 4 March 5th 06 10:30 AM
Skipping line on control break GKW in GA Excel Discussion (Misc queries) 1 January 4th 06 06:55 AM
Cannot Control - Break out of VBA vmegha Excel Discussion (Misc queries) 1 December 22nd 05 02:44 PM
Control Tab from Combo box- format control missing!! Mo Excel Discussion (Misc queries) 3 January 7th 05 01:09 PM


All times are GMT +1. The time now is 07:03 AM.

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

About Us

"It's about Microsoft Excel"