Deleting Columns Faster

nniedzielski

Active Member
Joined
Jan 8, 2016
Messages
386
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,
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,567
Office Version
365
Platform
Windows
Have you tried turning ScreenUpdating, calculations & events off?
 

nniedzielski

Active Member
Joined
Jan 8, 2016
Messages
386
Code:
Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Application.Calculation = xlCalculationManual
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,567
Office Version
365
Platform
Windows
In that case I'm not sure there's much more you can do.
How much data do you have on the sheet?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,567
Office Version
365
Platform
Windows
Having seen post#4, try
Code:
Application.EnableEvents = False
as well.
 

nniedzielski

Active Member
Joined
Jan 8, 2016
Messages
386
that didn't really help, and to answer your question in # 5, its ~ 20,000 rows and columns to BN
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,567
Office Version
365
Platform
Windows
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?
 

nniedzielski

Active Member
Joined
Jan 8, 2016
Messages
386
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,
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,567
Office Version
365
Platform
Windows
Glad you found a solution & thanks for the feedback
 

Forum statistics

Threads
1,078,499
Messages
5,340,740
Members
399,393
Latest member
farlow

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top