Good morning!
I have a macro that functions as it should but is slow. The macro strips out all of the report and page headers from the text file dumped from the AS400 and organizes the sheet in the desired manner. I realize that part of the reason it's slow is the size of the worksheet it's formatting (62,743 rows) but I'm hoping some of you folks might have ideas that would help me to speed this process up? All suggestions and comments are very much appreciated.
Thanks much!
Bill
I have a macro that functions as it should but is slow. The macro strips out all of the report and page headers from the text file dumped from the AS400 and organizes the sheet in the desired manner. I realize that part of the reason it's slow is the size of the worksheet it's formatting (62,743 rows) but I'm hoping some of you folks might have ideas that would help me to speed this process up? All suggestions and comments are very much appreciated.
Thanks much!
Bill
Code:
Sub Strip_Page_Report_Headers()
'Macro to strip out Report and Page headings to leave an Excel File with columns properly formatted.
On Error GoTo ErrorHandler
Application.EnableEvents = False
Windows("Estimator.xlsm").Activate 'Go to the Estimating Tool
Sheets("Item Master").Select 'Select the Test Data worksheet in the Estimating tool
Selection.EntireColumn.Hidden = False
Dim Ary As Variant
Dim i As Long
Ary = Array("*QUERY*", "*INVMASTB*", "*INVMASTAAA*", "*LIBRARY*", "*PRICEMSM*", "*DATE*", "TIME*", "*info*", "*PAGE*", "Pricing", "*Cost*", "*Page*", "*DELETED*", "*EDIORGI*", "*DELETE*", "*FORMAT*")
For i = 0 To UBound(Ary)
Range("A:O").Replace Ary(i), "=xxx", xlWhole, , False, , False, False
Next i
For i = 1 To 15
On Error Resume Next
Columns(i).SpecialCells(xlFormulas, xlErrors).EntireRow.Delete
On Error GoTo 0
Next
'Add Column Labels
Rows(1).Insert Shift:=xlDown
Range("A1").Select
ActiveCell.FormulaR1C1 = "ITEM"
Range("B1").Select
ActiveCell.FormulaR1C1 = "DESCRIPTION"
Range("C1").Select
ActiveCell.FormulaR1C1 = "COST"
ActiveCell.FormulaR1C1 = "Price"
' Set Column C as currency
Worksheets("Item Master").Columns("C").NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"
Columns.AutoFit
ErrorHandler:
Application.EnableEvents = True
End Sub