Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Setting page breaks

Hiya,

I've been rattling through a custom report which is made through VBA. I have
done everything except for setting the page breaks.

The report outlines data and city information for multiple countries
vertically down the page (one country at a time). The countries vary in the
number of rows that they have - generally each will fit on 1 page.

Is there a way that I can set the page ranges to match the country sections?
I can make the top row always the same or something of needed.

Would really appreciate any help on the above.

The final step I want to do after this is to create on a separate sheet an
index of every country on this report and the corresponding page number. If
you have a suggestion on this, would also appreciate.

Thanks for any help,

Basil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Setting page breaks

Assuming country column is A

Sub Insert_PBreak()
Dim oldval As String
Dim rng As Range
Dim rng1 As Range
Set rng1 = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
oldval = Range("A1")
For Each rng In rng1
If rng.Text < oldval Then
rng.PageBreak = xlPageBreakManual
oldval = rng.Text
End If
Next rng
End Sub

For the index sheet, record a macro while you run Advanced Filter on column
A to return Unique values only.

Then copy and paste to a new sheet.

Add your page numbers in an adjacent column.


Gord Dibben MS Excel MVP

On Wed, 13 Jan 2010 13:53:02 -0800, Basil
wrote:

Hiya,

I've been rattling through a custom report which is made through VBA. I have
done everything except for setting the page breaks.

The report outlines data and city information for multiple countries
vertically down the page (one country at a time). The countries vary in the
number of rows that they have - generally each will fit on 1 page.

Is there a way that I can set the page ranges to match the country sections?
I can make the top row always the same or something of needed.

Would really appreciate any help on the above.

The final step I want to do after this is to create on a separate sheet an
index of every country on this report and the corresponding page number. If
you have a suggestion on this, would also appreciate.

Thanks for any help,

Basil


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
Setting Page Breaks Ken Hudson Excel Discussion (Misc queries) 1 January 5th 10 08:47 PM
Setting and removing page breaks jday Excel Programming 2 May 18th 09 06:50 PM
Setting Vertical Page Breaks J.W. Aldridge Excel Programming 1 March 21st 08 08:13 PM
setting page breaks. Rod[_2_] Excel Programming 3 May 23rd 06 12:28 AM
Setting page breaks (another) Ian W[_2_] Excel Programming 1 March 15th 05 12:23 PM


All times are GMT +1. The time now is 02:29 PM.

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"