Re run macro when error pops out

nikhilrangarii

New Member
Joined
Sep 4, 2015
Messages
11
hi,

I need to re run macro when this error message display in text box or message box pop out.

Run-time error '-2146697204(800c00c)'

This site report that request is not valid.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Observe the following code. Basically you need to activate the on error function in the module where the error occurs; then add a error Handler which checks for the specific error you are looking for (I would use the error number but you can also use the error description) and finally add the relevant code to call the macro. Note- you may want to use the Application.Wait function Before attempting the rerun if the error relates to something like database availability.

Code:
Sub Macro1()
On Error GoTo Handler


x = 7 / 0 'cause error(divide by 0)




Handler:


'MsgBox Err.Number
    If Err.Number = 11 Then
    ' Code for handling the error is entered here.
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,854
Messages
6,127,339
Members
449,377
Latest member
CastorPollux

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