Hi again Jim,
You can speed up the execution of the routine a little bit by adding the highlighted statements:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Const sTARGET_SHEET As String = "Sheet2"
Dim wksTarget As Worksheet
Set wksTarget = ThisWorkbook.Sheets(sTARGET_SHEET)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With wksTarget
.Range("B:B").ClearContents
For i = 1 To Sheets.Count
.Cells(i, 2) = Sheets(i).Name
Next i
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
End Sub
Or you could just change the first line of the routine to:
Private Sub Worksheet_Activate()
then insert the routine into the VBA CodeModule for Sheet 3, and delete it from the CodeModule for ThisWorkbook.
And of course, you can even enter the "speeded-up" routine into just the CodeModule for Sheet 3.
Hope this helps - please let me know how you get on.
Regards,
Greg M
Bookmarks