Thank you all!
Dave, I've learned something new today, the "Me." As a last input maybe you
or sombody else can give me a clue how to reduce the B:B range to say 1000
rows?
I've picked out this as best suitable for the current needs:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
On Error Resume Next
Me.Cells.EntireRow.Hidden = False
Me.Range("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden
= True
Application.ScreenUpdating = True
End Sub
The code does still take a while, not as much as with a loop row by row, but
unnessesarily long.
Since I 'm new with " Me. ", I 've not find out how to achieve this -
checking the first 1000 rows, I mean, to speed up the process.
/Regards,
"Asking once more in shame - soon you've written all my code...."
Dave Peterson said:
Place this under the worksheet module:
Option Explicit
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
On Error Resume Next
Me.Cells.EntireRow.Hidden = False
Me.Range("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
Application.ScreenUpdating = True
End Sub
But if you wanted the same functionality for a few worksheets in the same
workbook, you could modify Bernie's original code to check the sheet
name
first
(still under ThisWorkbook):
Option Explicit
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Select Case LCase(Sh.Name)
Case Is = "sheet1", "sheet2"
Application.ScreenUpdating = False
On Error Resume Next
Sh.Cells.EntireRow.Hidden = False
Sh.Range("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden =
True
Application.ScreenUpdating = True
Case Else
'do nothing
End Select
End Sub
between
50 -