Afternoon all,
Really quick one.
I have some code (below) that generally works fine (to filter sheets), however, I don't want it to run on a new sheet called 'Summary' and I am getting a debug error.
Can someone add a line to basically say 'ignore Summary sheet' and run only on "Sheet 1". "Sheet 2" and "Sheet 3"
Thank you in advance
Really quick one.
I have some code (below) that generally works fine (to filter sheets), however, I don't want it to run on a new sheet called 'Summary' and I am getting a debug error.
Can someone add a line to basically say 'ignore Summary sheet' and run only on "Sheet 1". "Sheet 2" and "Sheet 3"
Thank you in advance
VBA Code:
Private Sub Workbook_Open()
Dim Sht As Worksheet, R As Range
Application.ScreenUpdating = False
For Each Sht In Me.Worksheets
If Sht.Name <> "Data Selection" Then
Set R = Sht.Range("A1").CurrentRegion
R.AutoFilter field:=1, Criteria1:="<>" & Sheets("Data Selection").Range("A1")
On Error Resume Next
Set R = R.Offset(1, 0).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
Sht.AutoFilterMode = False
If Not R Is Nothing Then R.EntireRow.Delete
End If
Sht.Rows.RowHeight = 25
Next Sht
With Sheets("Data Selection")
.Range("A1").Value = .Range("A1").Value
.Rows.RowHeight = 25
.Visible = xlHidden
End With
Application.ScreenUpdating = True
End Sub