Good morning,
I need to make several macros created on Excel 2010 VBA run on Excel 2000 and so far it's been a real clinic. The macros run perfectly on Excel 2010.
I got one working after a while, but this next has me stymied. It's pretty much over my head. I commented out the error handler so I could track down the error.
The macro errors on the line;
Windows("Estimator.xlsm").Activate
I tried replacing Windows with Workbooks but got the same error.
If I comment that line out as a test
it next complains about the line;
Range("A:D").Replace Ary(i), "=xxx", xlWhole, , False, , False, FalseI will be extremely grateful for any suggestion or input
Thanks much!
Bill
I need to make several macros created on Excel 2010 VBA run on Excel 2000 and so far it's been a real clinic. The macros run perfectly on Excel 2010.
I got one working after a while, but this next has me stymied. It's pretty much over my head. I commented out the error handler so I could track down the error.
The macro errors on the line;
Windows("Estimator.xlsm").Activate
I tried replacing Windows with Workbooks but got the same error.
If I comment that line out as a test
it next complains about the line;
Range("A:D").Replace Ary(i), "=xxx", xlWhole, , False, , False, FalseI will be extremely grateful for any suggestion or input
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.
'Timer - comment out the three lines below if you don't want the timer to run
Dim StartTime As Double
Dim MinutesElapsed As String
'Remember time when macro starts
StartTime = Timer
On Error GoTo ErrorHandler
With Application
.ScreenUpdating = False
.DisplayStatusBar = False
.Calculation = xlCalculationManual
.EnableEvents = False
.PrintCommunication = False
End With
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*", "*REPORT", "*invmast*", "Item", "Prod", "Pricing", "*Cost*", "*:*", "*DELETED*", "*EDIORGI*", "*DELETE*", "*FORMAT*")
For i = 0 To UBound(Ary)
Range("A:D").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").FormulaR1C1 = "ITEM"
Range("B1").FormulaR1C1 = "DESCRIPTION"
Range("C1").FormulaR1C1 = "COST"
' Set Column C as currency
Worksheets("Item Master").Columns("C").NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"
Columns.AutoFit
ErrorHandler:
With Application
.ScreenUpdating = True
.DisplayStatusBar = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.PrintCommunication = True
End With
'Timer end code - comment out two lines below if you don't want the timer to run
MinutesElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
MsgBox "This code ran successfully in " & MinutesElapsed, vbInformation
End Sub