ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print group of records with same Customer name (https://www.excelbanter.com/excel-programming/436339-print-group-records-same-customer-name.html)

freddy

Print group of records with same Customer name
 
I'd like some assistance in writing VBA version 6 code in Excel 2002. I have
a spreadsheet that has the following column headers:

Customer-Project-Site-TFID-Point-Run Hours

Under each column header could be a varying amount of customer names with
varying amounts of rows. What I'd like to do is, for each different customer
name, print the associated rows altogether. Please note that the rows are
already sorted in ascending order by Customer then Project, i.e., they are
not scattered in different rows. Please notify me of any other information
needed to develop a solution.

Gord Dibben

Print group of records with same Customer name
 
Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(1).Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And Not IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Wed, 18 Nov 2009 10:51:03 -0800, Freddy
wrote:

I'd like some assistance in writing VBA version 6 code in Excel 2002. I have
a spreadsheet that has the following column headers:

Customer-Project-Site-TFID-Point-Run Hours

Under each column header could be a varying amount of customer names with
varying amounts of rows. What I'd like to do is, for each different customer
name, print the associated rows altogether. Please note that the rows are
already sorted in ascending order by Customer then Project, i.e., they are
not scattered in different rows. Please notify me of any other information
needed to develop a solution.




All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com