G
Guest
Using XL 2003 & 97
After running the following loop, all of the sheets are selected except the
last sheet which has Cell A1 selected.
I wish all of the sheets had cell A1 selected (as per the VBA code) -
therefore as a user selectes the other sheets only A1 is selected in contrast
to all of the cells being selected as is the case now.
What do I not realize about the following loop?
Sub Unhide_All() ' Unhides all Columns, Rows and WorkSheets
Dim wks As Worksheet
Dim myOrigSheetProtectStatus As Boolean
For Each wks In Worksheets
myOrigSheetProtectStatus = ActiveSheet.ProtectContents
If myOrigSheetProtectStatus = True Then
ActiveSheet.Protect UserInterfaceOnly:=True
End If
Cells.Select
On Error Resume Next
Selection.EntireColumn.Hidden = False
On Error Resume Next
Selection.EntireRow.Hidden = False
wks.Visible = True
wks.Activate
ActiveWindow.FreezePanes = False
Cells.Range("A1").Select
If myOrigSheetProtectStatus = True Then
ActiveSheet.Protect UserInterfaceOnly:=False
End If
Next
End Sub
TIA Dennis
After running the following loop, all of the sheets are selected except the
last sheet which has Cell A1 selected.
I wish all of the sheets had cell A1 selected (as per the VBA code) -
therefore as a user selectes the other sheets only A1 is selected in contrast
to all of the cells being selected as is the case now.
What do I not realize about the following loop?
Sub Unhide_All() ' Unhides all Columns, Rows and WorkSheets
Dim wks As Worksheet
Dim myOrigSheetProtectStatus As Boolean
For Each wks In Worksheets
myOrigSheetProtectStatus = ActiveSheet.ProtectContents
If myOrigSheetProtectStatus = True Then
ActiveSheet.Protect UserInterfaceOnly:=True
End If
Cells.Select
On Error Resume Next
Selection.EntireColumn.Hidden = False
On Error Resume Next
Selection.EntireRow.Hidden = False
wks.Visible = True
wks.Activate
ActiveWindow.FreezePanes = False
Cells.Range("A1").Select
If myOrigSheetProtectStatus = True Then
ActiveSheet.Protect UserInterfaceOnly:=False
End If
Next
End Sub
TIA Dennis