ChrisFoster
Active Member
- Joined
- Jun 21, 2019
- Messages
- 256
- Office Version
- 365
- Platform
- Windows
Morning all,
I have some VBA code that on the face of it isn't too resource heavy, but it takes a lot longer to run than I'd expect.
There are circa 11,000 rows of data though so maybe I'm just being naive with my expectations.
Is there anything I can do to speed this up?
I have some VBA code that on the face of it isn't too resource heavy, but it takes a lot longer to run than I'd expect.
There are circa 11,000 rows of data though so maybe I'm just being naive with my expectations.
Is there anything I can do to speed this up?
VBA Code:
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+u
'
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Sheets("1.Filter-group-1").UsedRange.Copy
Sheets("pfs-Summary.csv").Select
ActiveSheet.Paste
Sheets("1.Filter-group-1").Select
Range("B:D").Delete
Cells.EntireColumn.AutoFit
Cells.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
Range("A1").Select
Columns("B:CW").Select
Application.CutCopyMode = False
Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"
End With
Cells.Replace What:="Original ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Cells.Columns.AutoFit
Cells.Replace What:="-", Replacement:="0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub