Annoying Pop up box in function

S

silvest

Hi, how do i set the 'error trappings' to be at the end, rather than as
I key into the function box.?

Eg.
Function DateConverter(XX)
Select Case XX
Case Is < 1000
MsgBox "blah blah", ,vbExclamation, "Too small"
End Select


Before i can even enter 5 digits, the message box will pop up once for
each digit i enter. say : 12345.. When i enter "1", box pops up once,
then again at 2, then 3...

Is it possible to get the msgbox to pop up ONLY at the end when i press
'ENTER' ??
 
D

Dave Peterson

Charles Williams posted a suggestion from Alex Koenig that seems to work ok:

Option Explicit
Function DateConverter(XX)

If (Not Application.CommandBars("Standard").Controls(1).Enabled) Then
Exit Function
End If

Select Case XX
Case Is < 1000
MsgBox "blah blah", vbExclamation, "too small"
End Select
End Function

It looks at the toolbar to see if you're in the wizard. (Try it and you'll see
lots of icons are disabled.)

But I don't know if I'd put a message box in a worksheet function. If I used
1000 of these functions and recalculated the worksheet and had errors, man,
would I be tired of dismissing those message boxes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top