Selecting Last Worksheet
Hello folks,
It seems that there is a tangible difference between these 2 macros
that have been suggested:-
===============================
Sub test()
With ActiveWorkbook
If .WorkSheets.Count 1 Then
Application.DisplayAlerts = False
.WorkSheets(.WorkSheets.Count).Delete
Application.DisplayAlerts = True
End If
End With
End Sub
================================
Sub test()
With ThisWorkbook
If .Sheets.Count 1 Then
Application.DisplayAlerts = False
.Sheets(.Sheets.Count).Delete
Application.DisplayAlerts = True
End If
End With
End Sub
================================
What's the difference between ThisWorkbook and ActiveWorkbook please?
And between Worksheets and Sheets?
Many thanks
Rob
|