KDavidP1987
Board Regular
- Joined
- Mar 6, 2018
- Messages
- 51
Greetings all,
I am trying to run a script which is supposed to delete the visible rows from a table I've filtered. However, when the script is ran it comes up with error msg: "Runtime error '1004': Delete method of range class failed.
I have tried it two different ways, based on solutions I've found through MrExcel, StackOverflow, and Ozgrid.
I've tried some other, lengthier, solutions as well to no avail. If you have any ideas I'm all ears, because I cannot figure it out.
If needed, here are some of the solution pages I had used:
https://www.mrexcel.com/forum/excel...w-delete-autofiltered-rows-except-header.html
https://www.ozgrid.com/forum/forum/...sible-rows-after-auto-filter-exclude-headings
Sincerely,
Kristopher
I am trying to run a script which is supposed to delete the visible rows from a table I've filtered. However, when the script is ran it comes up with error msg: "Runtime error '1004': Delete method of range class failed.
I have tried it two different ways, based on solutions I've found through MrExcel, StackOverflow, and Ozgrid.
Code:
Sub RemoveVisibleRows()
'Removes Visible rows, discluding the header
'Method 1
Worksheets("IncidentData").Range("A1:A100000").Offset(1,0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
'Method 2: (currently ' out)
'Range("A2:A100000").SpecialCells(xlCellTypeVisible).EntireRow.Delete
End Sub
If needed, here are some of the solution pages I had used:
https://www.mrexcel.com/forum/excel...w-delete-autofiltered-rows-except-header.html
https://www.ozgrid.com/forum/forum/...sible-rows-after-auto-filter-exclude-headings
Sincerely,
Kristopher
Last edited: