Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VB Excel Code returning my error message twice instead of once....

Private Sub CheckBox3_Click()
If CheckBox3 = True And Range("C2").Value = "1" And CheckBox2 = True
And Range("E2").Value = "Comments Cleared" Or Range("E2").Value = "No
Comments" Then
Range("f2").Value = "1"
End If
If CheckBox3 = True And CheckBox2 = False And Range("C2").Value < "1"
Or Range("C2").Value "1" And Range("E2").Value = "...Please Select..."
Or Range("E2").Value = "See Comments" Then
yourMsg = MsgBox("Workpaper must be completed, reviewed by
Senior/Manager, and comments must be addressed in order to pass to
Manager/Partner for review!", 0, "Error")
CheckBox3 = False
Range("f2").Value = "0"
End If
End Sub


the prior check box uses this code:

Private Sub CheckBox2_Click()
If CheckBox2 = True And Range("C2").Value < "1" Or Range("C2").Value
"1" Then
yourMsg = MsgBox("Workpaper must be 100% complete to pass on
to manager review", 0, "Error")
CheckBox2 = False
Range("d2").Value = "0"
End If
If CheckBox2 = True And Range("C2").Value = "1" Then
Range("d2").Value = "1"
CheckBox1 = True
End If
If CheckBox2 = False Then
Range("d2").Value = "0"
End If
End Sub


what is causing this :
yourMsg = MsgBox("Workpaper must be completed, reviewed by Senior/
Manager, and comments must be addressed in order to pass to Manager/
Partner for review!", 0, "Error")

to pop up twice...?

Thanks,
Andrew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default VB Excel Code returning my error message twice instead of once....

is this somehow connected to the checkbox3? Range("f2").Value = "0"

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


" wrote:

Private Sub CheckBox3_Click()
If CheckBox3 = True And Range("C2").Value = "1" And CheckBox2 = True
And Range("E2").Value = "Comments Cleared" Or Range("E2").Value = "No
Comments" Then
Range("f2").Value = "1"
End If
If CheckBox3 = True And CheckBox2 = False And Range("C2").Value < "1"
Or Range("C2").Value "1" And Range("E2").Value = "...Please Select..."
Or Range("E2").Value = "See Comments" Then
yourMsg = MsgBox("Workpaper must be completed, reviewed by
Senior/Manager, and comments must be addressed in order to pass to
Manager/Partner for review!", 0, "Error")
CheckBox3 = False
Range("f2").Value = "0"
End If
End Sub


the prior check box uses this code:

Private Sub CheckBox2_Click()
If CheckBox2 = True And Range("C2").Value < "1" Or Range("C2").Value
"1" Then
yourMsg = MsgBox("Workpaper must be 100% complete to pass on
to manager review", 0, "Error")
CheckBox2 = False
Range("d2").Value = "0"
End If
If CheckBox2 = True And Range("C2").Value = "1" Then
Range("d2").Value = "1"
CheckBox1 = True
End If
If CheckBox2 = False Then
Range("d2").Value = "0"
End If
End Sub


what is causing this :
yourMsg = MsgBox("Workpaper must be completed, reviewed by Senior/
Manager, and comments must be addressed in order to pass to Manager/
Partner for review!", 0, "Error")

to pop up twice...?

Thanks,
Andrew

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default VB Excel Code returning my error message twice instead of once....

It is being triggered by the change you make to the checkbox. If you change
the value of a checkbox it then triggers the click_event which causes your
code to run twice.

You need to add some extra logic to prevent this from happening, since you
are using series of logical checks in establishing what action to take it
could be incorporated into that. But it is not clear what you are trying to
do from the code posted.

But that is the reason. Hope it helps

--

Regards,
Nigel




wrote in message
...
Private Sub CheckBox3_Click()
If CheckBox3 = True And Range("C2").Value = "1" And CheckBox2 = True
And Range("E2").Value = "Comments Cleared" Or Range("E2").Value = "No
Comments" Then
Range("f2").Value = "1"
End If
If CheckBox3 = True And CheckBox2 = False And Range("C2").Value < "1"
Or Range("C2").Value "1" And Range("E2").Value = "...Please Select..."
Or Range("E2").Value = "See Comments" Then
yourMsg = MsgBox("Workpaper must be completed, reviewed by
Senior/Manager, and comments must be addressed in order to pass to
Manager/Partner for review!", 0, "Error")
CheckBox3 = False
Range("f2").Value = "0"
End If
End Sub


the prior check box uses this code:

Private Sub CheckBox2_Click()
If CheckBox2 = True And Range("C2").Value < "1" Or Range("C2").Value
"1" Then
yourMsg = MsgBox("Workpaper must be 100% complete to pass on
to manager review", 0, "Error")
CheckBox2 = False
Range("d2").Value = "0"
End If
If CheckBox2 = True And Range("C2").Value = "1" Then
Range("d2").Value = "1"
CheckBox1 = True
End If
If CheckBox2 = False Then
Range("d2").Value = "0"
End If
End Sub


what is causing this :
yourMsg = MsgBox("Workpaper must be completed, reviewed by Senior/
Manager, and comments must be addressed in order to pass to Manager/
Partner for review!", 0, "Error")

to pop up twice...?

Thanks,
Andrew


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
Format code returning error Mike K Excel Programming 2 November 17th 07 08:57 PM
VBA code to erase an array element returning Error 2042 ??? Patachoup Excel Programming 4 June 5th 07 11:31 AM
Code Error Message Excel 2000 - 2003 jfcby[_2_] Excel Programming 9 December 13th 06 04:41 AM
Need Error Message Box In VBA Code - Excel 2000 & 2003 jfcby[_2_] Excel Programming 4 December 1st 06 05:09 PM
Help with Error Message Box code Cutter[_11_] Excel Programming 2 July 9th 04 07:31 PM


All times are GMT +1. The time now is 09:16 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"