Error Checking

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
So I've written this error coding. I was hoping someone could check it over and tell me 1. why userform18 won't show when running and 2. Is there coding I can put in userform 18 that would allow me to "screenshot" a highlighted string of code (the code that error'd) and screenshot (or save as a pdf) the activeworkbook and then reset the code- basically allowing the user to continue attempting to use the workbook.

thanks!

Code:
 Sub Hi()

On Error GoTo Helper




*CODING*






'Error helper


Exit Sub
Helper:
	resp = MsgBox("We're sorry you've had this problem. Please save error codes [xxx] [" & Err.Number & "-" & Err.Description & "]. Would you " & _
		"like to fix the problem?", vbyesno, "Error Checker")
		If resp = vbYes Then
			Userform18.Show
		ElseIf resp = vbNo Then
			Exit Sub
		End If
End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I think that you are thinking about something like.....
Put this into module:
Code:
Function OtherDivide(a1 As Integer, b1 As Integer)
    On Error GoTo helper:
    OtherDivide = a1 / b1
    Exit Function
helper:
    OtherDivide = "you can't divide by zero"
    MsgBox ("you can't divide by zero")
End Function
then try in excel
Code:
=OtherDivide(5,1)
and
Code:
=OtherDivide(5,0)
 
Last edited:
Upvote 0
No no

just maknig sure there was no reason that instead of having stuff like "exit sub" I could use "exit function"
 
Upvote 0

Forum statistics

Threads
1,225,270
Messages
6,183,985
Members
453,201
Latest member
Brenda1970

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