ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Error Message in VBA (https://www.excelbanter.com/excel-discussion-misc-queries/148170-error-message-vba.html)

Elise148

Error Message in VBA
 
If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise

N.F[_2_]

Error Message in VBA
 


"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise


Hi Elise, im as well learning VBA and little by little Im building up on my
experience, but in the past I had a similar question as you,
How about putting in your macro a code for a re-set of your inputs when a
command button is clicked withing your sheet?

Elise148

Error Message in VBA
 
That's a good idea. The only problem is that I'm sorting data, inserting new
worksheets, and inserting hyperlinks through input boxes.

The first imput box comes up a little ways into the macro. What I am
thinking is that if someone accidentally pushed the macro button, there's no
way to stop the macro and undo the couple steps the macro did before the
input box, besides pushing the "Cancel" button, but that doesn't undo what
the macro did to that point in it...

Any ideas?

"N.F" wrote:



"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise


Hi Elise, im as well learning VBA and little by little Im building up on my
experience, but in the past I had a similar question as you,
How about putting in your macro a code for a re-set of your inputs when a
command button is clicked withing your sheet?


FSt1

Error Message in VBA
 
hi,
just after the input box statement put this...
If MsgBox("do you really want to do this?", vbOKCancel, Confirm) = vbCancel
Then
MsgBox ("Process terminated.")
Exit Sub
End If

regards
FSt1

"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise


Elise148

Error Message in VBA
 
Thanks, I'll give that a try!

"FSt1" wrote:

hi,
just after the input box statement put this...
If MsgBox("do you really want to do this?", vbOKCancel, Confirm) = vbCancel
Then
MsgBox ("Process terminated.")
Exit Sub
End If

regards
FSt1

"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise



All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com