Jalal Kasmani
Board Regular
- Joined
- Feb 14, 2015
- Messages
- 52
- Office Version
- 365
- Platform
- Windows
After filter, i want the cursor on the second row, then select that row and dragdown. can anyone help ?
Sub Macro2()
'
' Macro2 Macro
'
Dim x As Long, c As Long, r As Long
With ActiveSheet
c = .Cells.Find(What:="*", SearchOrder:=xlColumns, SearchDirection:=xlPrevious, LookIn:=xlValues).Column
r = .Cells(Rows.Count, c).End(xlUp).Row
x = .Range("A1").End(xlDown).Row
With .Range("a" & x, Cells(r, c))
.AutoFilter field:=5, Criteria1:="10"
On Error Resume Next
'.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).ClearContents 'to clear the cells
'.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete 'to delete entire row
On Error GoTo 0
.AutoFilter
End With
End With
End Sub
Sub Macro2()
Dim x As Long, c As Long, r As Long
With ActiveSheet
c = .Cells.Find(What:="*", SearchOrder:=xlColumns, SearchDirection:=xlPrevious, LookIn:=xlValues).Column
r = .Cells(Rows.Count, c).End(xlUp).Row
If .Cells(1, 1) <> "" Then
x = 1
Else
x = .Range("A1").End(xlDown).Row
End If
With .Range("a" & x, Cells(r, c))
.AutoFilter field:=5, Criteria1:="10"
On Error Resume Next
'.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).ClearContents 'to clear the cells
'.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete 'to delete entire row
On Error GoTo 0
.AutoFilter
End With
End With
End Sub