Deleting Columns Faster

nniedzielski

Well-known Member
Joined
Jan 8, 2016
Messages
598
Office Version
  1. 2019
Platform
  1. Windows
Hello all-

I am running a line of code to delete multiple columns of unneeded info, this is what i am running:

Code:
Range("A:B,H:H,J:AD,AG:AK,AN:AX,AZ:BJ,BL:BN").EntireColumn.Delete

Is there a way to run this code and make it go faster? I have a timer on for this line and its taking between 9 and 10 seconds to just run this part, i would like to get that down to 2-3 seconds if possible,

thank you,
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Have you tried turning ScreenUpdating, calculations & events off?
 
Upvote 0
Code:
Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Application.Calculation = xlCalculationManual
 
Upvote 0
In that case I'm not sure there's much more you can do.
How much data do you have on the sheet?
 
Upvote 0
Having seen post#4, try
Code:
Application.EnableEvents = False
as well.
 
Upvote 0
that didn't really help, and to answer your question in # 5, its ~ 20,000 rows and columns to BN
 
Upvote 0
For that amount of data it takes me under 1 second
I've tested it on 100,000 rows with columns A:CO and it took about 4 seconds.

Try Ctrl + End where does that take you?
 
Upvote 0
this is from a document that i export to Excel, and theres some formatting, so i removed the formatting and it took less than a second, so i think i will handle it that way, and then just put formatting back in at the end,
 
Upvote 0
Glad you found a solution & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,173
Members
452,615
Latest member
bogeys2birdies

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