View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Cannot Dismiss the MsgBox


hi
you're caught in a loop. the solution i posted earlier displayed the msgbox
only when a red font was found. i added code to your other post to correct
multiple instances of red fonts ie exit sub after the msgbox. my bad for not
seeing that.
the second msgbox you added will display for each and every cell in the loop
that is not red font. this is why you can't get rid of it.
suggestion. during development and testing, choose a much smaller range. and
use step mode to trouble shoot.

what is the purpose of the second msgbox???
what are we trying to do????
if you're just adding a "good job" message at the end then move the second
msgbox OUTSIDE the loop.

post back with more info if i am not understanding.

regards
FSt1

"Ron" wrote:

Hello all, I don't have a clue why when I click on the OK or Cancel
button the MsgBox does not go away. The only way I can get out is to
kill Excel with Control/Alt Delete and end Excel. How do I program
the cancel button to end the sub or at least dismiss the MsgBox when
clicking OK or Cancel? Any suggestions? Thank you all for your
assistance, Ron


Sub testfollowup()
Dim c As Range
For Each c In ActiveSheet.Range("K12:AI10000")
If c.Font.ColorIndex = 3 Then
MsgBox "Please make additional corrections", vbExclamation +
vbOKCancel, "TEST"
Else
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 + vbOKCancel, "TEST"
End If
Next c
End Sub