tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
HI Everyone,
Not sure how I've gone wrong but I'm trying to delete all rows that are visible after I filter a row except the header but I'm having a nightmare
Can't see what I've done wrong, feel free to change as much as needed but please help
Thanks
Tony
My Code:
Not sure how I've gone wrong but I'm trying to delete all rows that are visible after I filter a row except the header but I'm having a nightmare
Can't see what I've done wrong, feel free to change as much as needed but please help
Thanks
Tony
My Code:
Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Sub Macro1()[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Arch = "HS0001"[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Sheets("Overview").Select[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Arow = Sheets("Overview").Cells(Rows.Count,"H").End(xlUp).Row[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]If Arow < 2 Then[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Arow = 2[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]End If[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Sheets("Overview").Range("A1","BR" & Arow).AutoFilter Field:=11, Criteria1:=Arch[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Sheets("Overview").Range("H2","H" & Arow ).SpecialCells(xlCellTypeVisible).EntireRow.Delete[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]ActiveSheet.ShowAllData[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]
Last edited: