Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

VB Excel Code returning my error message twice instead of once....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
a.cunje@gmail.com - 30 Nov 2007 16:17 GMT
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
John Bundy - 30 Nov 2007 16:38 GMT
is this somehow connected to the checkbox3?  Range("f2").Value = "0"

Signature

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

> Private Sub CheckBox3_Click()
> If CheckBox3 = True And Range("C2").Value = "1" And CheckBox2 = True
[quoted text clipped - 41 lines]
> Thanks,
> Andrew
Nigel - 30 Nov 2007 16:56 GMT
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

Signature

Regards,
Nigel
nigelnospam@9sw.co.uk

> Private Sub CheckBox3_Click()
> If CheckBox3 = True And Range("C2").Value = "1" And CheckBox2 = True
[quoted text clipped - 41 lines]
> Thanks,
> Andrew
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.