This is a macro I found online to freeze the first tab in my workbook. I am new to VBA, so please explain in details.
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim sc As Long ' count of sheets
Dim NewPos As Long ' index of serlected sheet
Application.EnableEvents = False
Application.ScreenUpdating = False
If ActiveSheet.Index <> 1 Then
sc = Sheets.Count
NewPos = ActiveSheet.Index
For i = 2 To NewPos - 1
Sheets(2).Move After:=Sheets(sc)
Next i
Sheets(1).Activate
Sheets(2).Activate
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Bookmarks