The two routines testme and testme2 should go into a general module:
Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
wks.PageSetup.PrintTitleRows = "$1:$11"
Next wks
End Sub
Sub testme2()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
wks.PageSetup.PrintArea = "$A$1:$I$99"
Next wks
End Sub
But they could be combined to do both at the same time:
Option Explicit
Sub testmeBoth()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
wks.PageSetup.PrintTitleRows = "$1:$11"
wks.PageSetup.PrintArea = "$A$1:$I$99"
Next wks
End Sub
But this still goes into a general module--not behind a worksheet and not under
ThisWorkbook.
And you're dragging pagebreaks to different locations--do you have a reason to
put the page breaks where you drag them--or is just based on look?
If you answer you want page breaks after every "xxxx" in column A or something
that a program can determine, you may get a bit more help.
The only method I know for moving a page break is while viewing a worksheet
in Page Break Preview via click and drag or via Insert drop down menu
commands to Insert Page Break or Remove Page Break. Again the problem is that
method is via one worksheet at a time.
If I understand your other suggestion it's that I post here what I've
inserted into the Visual Basics Code window, which is:
Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
wks.PageSetup.PrintTitleRows = "$1:$11"
Next wks
Sub testme2()
Dim wks As Worksheet
For Each wks In ActiveWindow.SelectedSheets
wks.PageSetup.PrintArea = "$A$1:$I$99"
Next wks
Private Sub Worksheet_Activate()
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Option Explicit
The sign of of trouble is a dialogue box containing the word error and when
I click OK the code window is displayed and either "Private Sub
Worksheet_Activate()" or
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)" - don't
recall - is yellow highlighted.
Thanks,
KevinG