I have some code that copies a worksheet to a new workbook and does a little formatting, nothing complicated.
My problem is that I want to set 'normal' view so it doesn't have the page numbers on.
If I step through my code it works fine, but for some reason if I run it in one go, it reverts to page break view??? I've put a pause in at the end and this confirms that the code works, but just reverts for some reason when the macro is finished.
Here is the code:
Any ideas where I'm going wrong?
My problem is that I want to set 'normal' view so it doesn't have the page numbers on.
If I step through my code it works fine, but for some reason if I run it in one go, it reverts to page break view??? I've put a pause in at the end and this confirms that the code works, but just reverts for some reason when the macro is finished.
Here is the code:
Code:
'Select and copy summary sheet to new workbook
Sheets("Summary sheet").Select
Sheets("Summary sheet").Copy
'Remove formulae and any notes not on the report
Columns("A:K").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues
Columns("L:BJ").ClearContents
Rows("116:776").ClearContents
ActiveSheet.Shapes("Button 5").Delete
'unlock cells to be edited by BSP unit
Range("A53:K62").Select
Selection.Locked = False
Selection.FormulaHidden = False
'Protect Sheet
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWindow.SmallScroll Down:=-45
Range("A1").Select
'set normal view
ActiveWindow.View = xlNormalView
Any ideas where I'm going wrong?