PC Review


Reply
Thread Tools Rate Thread

blank row after control break

 
 
=?Utf-8?B?R3JlZ05nYQ==?=
Guest
Posts: n/a
 
      6th Sep 2007
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 With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      6th Sep 2007
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 <(E-Mail Removed)>
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 With Quote
 
=?Utf-8?B?R3JlZ05nYQ==?=
Guest
Posts: n/a
 
      6th Sep 2007
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 <(E-Mail Removed)>
> 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 With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      6th Sep 2007
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 <(E-Mail Removed)>
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 <(E-Mail Removed)>
>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert blank row macro after a break in a group Andy Microsoft Excel Misc 1 5th Nov 2009 09:54 PM
Page Break cause Blank pages Lamar Microsoft Access Reports 1 20th Oct 2009 02:38 AM
Blank line after control break GregNga Microsoft Excel Misc 1 20th Nov 2008 05:03 PM
Blank Page After Section Break? =?Utf-8?B?QnJhbmRvbg==?= Microsoft Word Document Management 5 6th Mar 2007 12:27 AM
Blank line that don't do a page break. Possible? Eric Fortier Microsoft Word New Users 2 6th Mar 2006 05:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:47 AM.