Hi All,
I have the following macro, which I did not write myself. It works perfectly, but now I want to add in some additional steps after this code finishes running. The problem is that Excel seems to just ignore everything I put after this piece. Any idea why?
I have the following macro, which I did not write myself. It works perfectly, but now I want to add in some additional steps after this code finishes running. The problem is that Excel seems to just ignore everything I put after this piece. Any idea why?
Code:
Dim wsName As String
Dim RangeError As Boolean
'--------------------------------
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
On Error GoTo NoEssbaseRange
'- main loop
For Each ws In Worksheets
wsName = ws.Name
RangeError = False
Application.GoTo Reference:=ws.range("_essbase")
If Not RangeError Then Application.Run Macro:="EssMenuRetrieve"
Next
On Error GoTo 0
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Exit Sub
'------------------------------------------------------------------
'- handle the Excel error produced when the range does not exist
'- comment out the MsgBox line unless you need to see each one
NoEssbaseRange:
'MsgBox ("Worksheet '" & wsName & "' has no essbase range.")
RangeError = True ' stops retrieve running in the next line above
Resume Next ' keep the macro running