Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Why doesn't this work

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Why doesn't this work

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Why doesn't this work

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Why doesn't this work

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
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
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


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