Hi
I have been playing around with a macro I was shown at College many moons ago before I realised I would never be any good at VBA.
The macro simply unhides a protected worksheet and copies it to the end of the workbook, then displays an input box asking you to name the sheet.
After remembering why I was no good at VBA for a few hours, I got it all working except 1 thing....The new worksheet won't move to the end. The first one does, but the rest go in front of this one.
The vba code follows, I suspect the problem is with the "Copy After:=Sheets(10)" line, but have lost patience.
.....................................................................................................
Dim NewPageName As String
Sub NewPage()
'
' NewPage Macro
' Macro recorded 28/01/2003 by
'
'
Sheets("Master").Visible = True
Sheets("Master").Copy After:=Sheets(10)
Sheets("Master").Select
ActiveWindow.SelectedSheets.Visible = False
NewPageName = InputBox("What would you like to call your new Worksheet")
ActiveWindow.ActiveSheet.Name = NewPageName
End Sub
.......................................................................................................
I have been playing around with a macro I was shown at College many moons ago before I realised I would never be any good at VBA.
The macro simply unhides a protected worksheet and copies it to the end of the workbook, then displays an input box asking you to name the sheet.
After remembering why I was no good at VBA for a few hours, I got it all working except 1 thing....The new worksheet won't move to the end. The first one does, but the rest go in front of this one.
The vba code follows, I suspect the problem is with the "Copy After:=Sheets(10)" line, but have lost patience.
.....................................................................................................
Dim NewPageName As String
Sub NewPage()
'
' NewPage Macro
' Macro recorded 28/01/2003 by
'
'
Sheets("Master").Visible = True
Sheets("Master").Copy After:=Sheets(10)
Sheets("Master").Select
ActiveWindow.SelectedSheets.Visible = False
NewPageName = InputBox("What would you like to call your new Worksheet")
ActiveWindow.ActiveSheet.Name = NewPageName
End Sub
.......................................................................................................