J
John Keith
I am using an autofilter to select rows that I want to delete, then
delete them, I then turn off the autofilter and select cell A2 and
enable screenupdating. But at the end of executing this code row A2 is
not visible, rather a row much lower (608 actually) is visible in the
window. How do I get row A2 to be visible in the window?
Dim rTable As Range
Range("A1").Select
With Selection
If .Cells.Count > 1 Then
Set rTable = Selection
Else
Set rTable = .CurrentRegion
On Error GoTo 0
End If
End With
Range("A2").Select
ActiveSheet.AutoFilterMode = False
' Delete all rows that are NOT for year 2005
rTable.AutoFilter Field:=2, Criteria1:="<>*"2005"*",
Operator:=xlAnd
rTable.Offset(1,
0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
Range("A1").Select
ActiveSheet.AutoFilterMode = False
Range("A2").Select
Application.ScreenUpdating = True
John Keith
(e-mail address removed)
delete them, I then turn off the autofilter and select cell A2 and
enable screenupdating. But at the end of executing this code row A2 is
not visible, rather a row much lower (608 actually) is visible in the
window. How do I get row A2 to be visible in the window?
Dim rTable As Range
Range("A1").Select
With Selection
If .Cells.Count > 1 Then
Set rTable = Selection
Else
Set rTable = .CurrentRegion
On Error GoTo 0
End If
End With
Range("A2").Select
ActiveSheet.AutoFilterMode = False
' Delete all rows that are NOT for year 2005
rTable.AutoFilter Field:=2, Criteria1:="<>*"2005"*",
Operator:=xlAnd
rTable.Offset(1,
0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
Range("A1").Select
ActiveSheet.AutoFilterMode = False
Range("A2").Select
Application.ScreenUpdating = True
John Keith
(e-mail address removed)