Seamus2626
asked on
Delete zeros sub
Hi,
I get the following error when i am trying to delete all rows in Col K that contain Zero
"Apllication-defined or object-defined error"
It errors on line
(ActiveSheet.UsedRange.Row s.Count - 1).Rows.Delete
Can anyone see why?
Thanks
Seamus
I get the following error when i am trying to delete all rows in Col K that contain Zero
"Apllication-defined or object-defined error"
It errors on line
(ActiveSheet.UsedRange.Row
Can anyone see why?
Thanks
Seamus
Rows("1:1").Select
Range("H1").Activate
Selection.AutoFilter
Range("K1").Select
Selection.AutoFilter Field:=11, Criteria1:="0"
Worksheets("Suspense File").Range("K1").AutoFilter Field:=11, Criteria1:="0"
Application.DisplayAlerts = False
ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
Application.DisplayAlerts = True
ActiveSheet.ShowAllData
Can you post a sample file please?
Try
ActiveSheet.UsedRange.Offs et(1, 0).Resize(ActiveSheet.Used Range.Rows .Count - 1).entirerow.Delete
ActiveSheet.UsedRange.Offs
I tryed you code on a sample sheet and I didn't get any error so it would help to see a sample file please.
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The macro is detecting "UsedRange" as the entiore sheet down to row 65536. So when you try to use offset(1,0) you are referencing row 64437 which does not exist
Try
activesheet.autofilter.ran ge.entirer ow.delete
instead
activesheet.autofilter.ran
instead
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys,
Cheers,
Seamus
Cheers,
Seamus