Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Cannot Dismiss the MsgBox


Good pickup Rob. I was guilty of not assessing what the the rest of the code
was doing. Only providing the answer on how to handle the user response.

The following code displays the cell Id with the error and gives the user
the option of continuing the test (and perhaps make a note of the error cell
Id) or abort the test and fix the error and then run the test again. If
processing is continued then bolError is set to true so that the final msgbox
displays that there are still errors.

The final msgbox/s do not require testing the user response.

Sub testfollowup()
Dim c As Range
Dim bolErrors As Boolean
Dim userResponse As Variant
For Each c In ActiveSheet.Range("K12:AI10000")
If c.Font.ColorIndex = 3 Then
userResponse = MsgBox("Cell " & c.Address(0, 0) _
& " not corrected." & vbCrLf & _
"OK to continue or Cancel to abort test.", _
vbExclamation + vbOKCancel, "TEST")
bolErrors = True
If userResponse = vbCancel Then
Exit Sub
End If
End If
Next c

If bolErrors = False Then
MsgBox "Data validated, good job!" _
& vbNewLine & _
"If the sheet is to be printed, " & _
"clicking on the Print Setup button " & _
"prepares the file for printing.", _
vbExclamation, "TEST"
Else
MsgBox "Errors exist." & vbCrLf & _
"Correct and run test again."
End If

End Sub


--
Regards,

OssieMac


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel (Dismiss) Input Box Ron[_6_] Excel Programming 1 April 16th 09 08:21 PM
msgbox ranswert Excel Programming 5 February 15th 08 09:43 PM
dismiss blanks in lookup Manuel Excel Worksheet Functions 5 July 30th 07 02:32 AM
Dismiss a dialog box (Via a Macro) msnews.microsoft.com[_9_] Excel Programming 3 October 28th 05 11:43 AM
Preventing Form Dialog dismiss (Red X) Jim Zeeb[_2_] Excel Programming 3 August 1st 05 01:16 AM


All times are GMT +1. The time now is 11:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"