Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm a neophyte when it comes to writing macros, so please forgive my
ignorance. I assemble workbooks based on templates I've created over time. Of course, as time passes, each template evolves. One of the problems I have is getting the page numbers to work correctly. I place them in a header so that they will print in a particular location in my spreadsheet. Of course, this location has moved over time (slightly, one or two characters to the left or right) and it's been tedious to edit these manually in a spreadsheet that has several (50-100) worksheets. The page numbers also move depending if the total number of pages is less than 10, less than 100 or more than 100. What I did was enter macro record mode, create a macro and edit it to suite. Here is the copy of the code: Sub PageNumberPlus() ' Keyboard Shortcut: Ctrl+Shift+P With ActiveSheet.PageSetup .RightHeader = _ "&""EurostileExtended-Roman-DTC,Bold""&8 &P &N" End With End Sub This works great. All I have to do is to edit the number of spaces before "&P" and befor "&N". Unfortunately, I have to select a single worksheet before executing the macro. What I would like to to is to select a group of worksheets and have the macro cycle on every worksheet that is selected. How would I modify the code to make this work? Thanks, Bill Allen |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |