Return to starting point
We store the sheet & cell and then return the
Sub HolidayRemove()
Dim oldSheet As Worksheet
Dim oldCell As String
Set oldSheet = ActiveSheet
oldCell = ActiveCell.Address
'Code provided b Mike H
Application.ScreenUpdating = False
On Error GoTo ErrorHandler
For n = 1 To Sheets.Count
If Sheets(n).Name < "Holidays" Then
Sheets(n).Select
Sheets(n).Unprotect
With Sheets(n)
Range("S5").Activate
ActiveSheet.Shapes.SelectAll
Selection.Delete
Range("K1").Value = ""
Sheets(n).Protect
End With
End If
Next n
ErrorHandler:
Application.ScreenUpdating = True
oldSheet.Activate
Range(oldCell).Select
End Sub
--
Gary''s Student - gsnu2007k
"Patrick C. Simonds" wrote:
Any way that the code below can be made to return me to the worksheet and
cell were the code was triggered?
Sub HolidayRemove()
'Code provided b Mike H
Application.ScreenUpdating = False
On Error GoTo ErrorHandler
For n = 1 To Sheets.Count
If Sheets(n).Name < "Holidays" Then
Sheets(n).Select
Sheets(n).Unprotect
With Sheets(n)
Range("S5").Activate
ActiveSheet.Shapes.SelectAll
Selection.Delete
Range("K1").Value = ""
Sheets(n).Protect
End With
End If
Next n
ErrorHandler:
Application.ScreenUpdating = True
End Sub
|