Entirerow.delete Rows function Error 400 problem

Devonair

New Member
Joined
Apr 17, 2019
Messages
26
Hi guys,

I made this command, before it was working fine. I have been using it for quite sometime now.

Sheets("DATABASE").Rows("4:1048576").Delete

Now suddenly there is an error showing, I didn't change anything to my programming.

Error 400.

Tried this too in hope that it will get fixed.

Sheets("DATABASE").Rows("4:1048576").EntireRow.Delete

But no success.

I experimented with it, tried reducing the cells value to 4:1048000 It worked for a short while after a few calls... then it started its pop up Error 400 again.

Can anybody explain to me why is this happening. ?


Thanks again for the help.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
If you run the code below does it give any more info?

Code:
Sub Errcheck()
On Error GoTo Errorcatch
Sheets("DATABASE").Rows("4:1048576").Delete
Exit Sub

Errorcatch:
MsgBox Err.Description
End Sub

Btw, is there any reason why you are deleting so many rows?
 
Last edited:
Upvote 0
If you run the code below does it give any more info?

Code:
Sub Errcheck()
On Error GoTo Errorcatch
Sheets("DATABASE").Rows("4:1048576").Delete
Exit Sub

Errorcatch:
MsgBox Err.Description
End Sub

Btw, is there any reason why you are deleting so many rows?

When I run step by step It showed an error 1004 something...

I started using this procedure cause I noticed there are data's that are not seen I made sure all are deleted...
My file reached 10mb, after I accidentally discovered this, I made it a routine, my file size went down from 10mb to 600kb.
Since then When I refresh my sheet I use this method of deletion.

now I made it 4:10000 it works with no error. I just want to know why sometimes it works sometimes it don't. I want it to be all cells downward deleted to be very clean and sure like before.
 
Upvote 0
Upvote 0
Thanks you for your links it worked there is an object way out there on my sheet >_<
I searched it using Ctrl+G, Special, Objects option then Tab one by one the object.

You are trully a life saver.
 
Upvote 0
You could also use


Code:
Sub MM1()
    Range(Rows("4:4"), Rows("4:4").End(xlDown)).EntireRow.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,946
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top