Macro to insert page breaks when values in 1 or more columns changes

M

Michael G

I have spreadshete that uses MS Query to load data. The
data needs page breaks when values change in some key
columns. How do I write a macro that scans the key columns
and inserts a horizontal page break when the values change.
 
T

Tom Ogilvy

Do you mean vertical pagebreak? If you really want horizontal, then what
row would need to be checked for differences - you description doesn't match
horizontal. Writing a macro requires specific information. What are you
key columns - what condition requires a pagebreak, where is you data located
and so forth.
 
M

Michael G

The spreadsheet is sorted by values in columns A, B & C.
When any of the values in these columns change a page
break needs to be inserted. I'm assuming I can select the
range $A,$B,$C , search the range and when there is a
change insert a vertical page break.
 
L

Lin

Thanks for your code. I am new in Macro. We need to insert
a page number after the break line? Can you tell me how to
do so?
 
T

Tom Ogilvy

Go into View=>Header and Footer and create a custom footer or header that
contains the page number. (Excel will generate the actual page number - you
just specify in the Header or footer that you want a page number using the #
icon.
 
T

Tom Ogilvy

See you had some important information in the subject. Best to put all the
information in the body of the email

you can go into Data=>subtotals and have it do this for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top