Macros taking too long to process

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings,
I have a VBA that has about 15 Macros, and it works great. The only problem I have 4 macros that seem to take way too long. Fortunately, they're are short macros. I believe it has something to do with "Entire Column". I am hoping it is just a small tweak. I do apologize for having 4, but I thought these were short ones. Again they work fine, but for whatever reason it takes longer than I think it should.

Thank you very much indeed.



VBA Code:
Sub delCol()
        Dim sourceSheet As Worksheet
        Set sourceSheet = Sheet1
     sourceSheet.Range("A:A, E:E, G:G, I:K, M:X").EntireColumn.Delete
    End Sub

VBA Code:
Sub FIRST_TAIL()
        Dim sourceSheet As Worksheet
        Set sourceSheet = Sheet1
     sourceSheet.Range("C:C").EntireColumn.Delete
    End Sub

VBA Code:
Sub moveColumn()
With ActiveSheet
    Columns("G").Cut
    Columns("D").Insert Shift:=xlToRight
    Columns("H").Cut
    Columns("f").Insert Shift:=xlToRight
    End With
End Sub

VBA Code:
Sub Left_Align()
   With Sheets("Global Reach Out").Cells
      .Font.Name = "Times New Roman"
      .Font.Size = 12
      .HorizontalAlignment = xlLeft
      .BorderAround xlNone
      .VerticalAlignment = xlCenter
      .EntireColumn.AutoFit
      .WrapText = False
       End With
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
In each one, try placing these lines of VBA code right underneath the "Sub" line:
VBA Code:
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Then place this code right above the "End Sub" line of each one:
VBA Code:
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True

Does that help speed things up?
 
Upvote 0
With this line of code:
With Sheets("Global Reach Out").Cells
It means all 10 billion cells or so on your worksheet.
This may take a long time for sure.
And would you please be more specific about the term Long time.
Some users think 2.1 seconds is a long time
 
Upvote 0
This is what I came up with:

VBA Code:
Sub delCol()
'
    Dim sourceSheet As Worksheet
'
    Set sourceSheet = Sheet1
    sourceSheet.Range("A:A, E:E, G:G, I:K, M:X").Delete
End Sub

VBA Code:
Sub FIRST_TAIL()
'
    Dim sourceSheet As Worksheet
'
    Set sourceSheet = Sheet1
    sourceSheet.Range("C:C").Delete
End Sub

VBA Code:
Sub moveColumn()
'
    Application.ScreenUpdating = False
       Application.Calculation = xlCalculationManual
'
    With ActiveSheet
        Columns("G").Cut
        Columns("D").Insert
        Columns("H").Cut
        Columns("f").Insert
    End With
'
       Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
End Sub

VBA Code:
Sub Left_Align()
'
    Application.ScreenUpdating = False
       Application.Calculation = xlCalculationManual
'
    With Sheets("Global Reach Out").UsedRange
        .Font.Name = "Times New Roman"
        .Font.Size = 12
        .HorizontalAlignment = xlLeft
        .BorderAround xlNone
        .VerticalAlignment = xlCenter
        .WrapText = False
        .EntireColumn.AutoFit
    End With
'
       Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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