Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I created a form in excel and when the user clicks on a checkbox I want
option button to default to true or false. I wrote the following statement: Private Sub chkQAuto_Click() If chkQAuto.Value = False Then optDe3.Value = True And optAsir3.Value = True 'Else: optDe3.Value = False And optAsir3.Value = False End If End Sub Can someone tell me why it doesn't work? ~Nicole |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nicole,
You are misusing the AND keyword. optDe3.Value = True And optAsir3.Value = True should be optDe3.Value = True optAsir3.Value = True -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Nicole D." wrote in message ... I created a form in excel and when the user clicks on a checkbox I want option button to default to true or false. I wrote the following statement: Private Sub chkQAuto_Click() If chkQAuto.Value = False Then optDe3.Value = True And optAsir3.Value = True 'Else: optDe3.Value = False And optAsir3.Value = False End If End Sub Can someone tell me why it doesn't work? ~Nicole |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub chkQAuto_Click()
If chkQAuto.Value = False Then optAsir3.Value = True optDe3.Value = True Else optDe3.Value = False optAsir3.Value = False End If End Sub "Chip Pearson" wrote: Nicole, You are misusing the AND keyword. optDe3.Value = True And optAsir3.Value = True should be optDe3.Value = True optAsir3.Value = True -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Nicole D." wrote in message ... I created a form in excel and when the user clicks on a checkbox I want option button to default to true or false. I wrote the following statement: Private Sub chkQAuto_Click() If chkQAuto.Value = False Then optDe3.Value = True And optAsir3.Value = True 'Else: optDe3.Value = False And optAsir3.Value = False End If End Sub Can someone tell me why it doesn't work? ~Nicole |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nicole,
As Chip pointed out, you can't execute two separate statements with the And operator. You could use the colon (":"), but I personally don't use those much in my code. A quicker way to do what you're trying to do is this: optDe3.Value = Not chkQAuto.Value optAsir3.Value = Not chkQAuto.Value -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Nicole D. wrote: I created a form in excel and when the user clicks on a checkbox I want option button to default to true or false. I wrote the following statement: Private Sub chkQAuto_Click() If chkQAuto.Value = False Then optDe3.Value = True And optAsir3.Value = True 'Else: optDe3.Value = False And optAsir3.Value = False End If End Sub Can someone tell me why it doesn't work? ~Nicole |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to update a column in a work based on another work sheet | New Users to Excel | |||
how can i automatically generate work order numbers from work orde | Excel Discussion (Misc queries) | |||
flash object dont work in my excel work sheet | Excel Discussion (Misc queries) | |||
Counting dates in multiple work sheets and work books | Excel Discussion (Misc queries) | |||
Is there away to keep "auto save" from jumping to the first work sheet in the work book? | New Users to Excel |