Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Checkboxes, AND, OR statements

This is kind of similar to my last post, but I'm working with AND
statements again in VBA. I'm trying to enter a value into a cell only
if 2 or more different check boxes are marked off. Although this is
very very wrong, something like:

If ckbCoast = True

And

If ckbSFR = True Then

Range("A168").Value = "O"

End If

As another very incorrect example:

If ckbCoast = True

And

If ckbSFR = True

OR

If ckbAdd = True Then

Range("A168").Value = "O"

End If

Thanks for the help guys!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Checkboxes, AND, OR statements

the following pseudo code may give some ideas.

If ckbCoast = True And _
ckbSFR = True Then

Range("A168").Value = "O"

End If

If (ckbCoast = True And _
ckbSFR = True) OR
(ckbCoast = True And _
ckbAdd = True) OR _
(ckbSFR = True And _
ckbAdd = True) Then

Range("A168").Value = "O"
End If

if clng(ckbSFR) + clng(ckbADD) + _
clng(ckbCoast) <= -2 then
Range("A168").Value = "O"
End if





--
Regards,
Tom Ogilvy



" wrote:

This is kind of similar to my last post, but I'm working with AND
statements again in VBA. I'm trying to enter a value into a cell only
if 2 or more different check boxes are marked off. Although this is
very very wrong, something like:

If ckbCoast = True

And

If ckbSFR = True Then

Range("A168").Value = "O"

End If

As another very incorrect example:

If ckbCoast = True

And

If ckbSFR = True

OR

If ckbAdd = True Then

Range("A168").Value = "O"

End If

Thanks for the help guys!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Checkboxes, AND, OR statements

Thanks, this looks great. Also, is there a way to link the check boxes
between 2 different user forms (say ckbCoast is in frmLocal and ckbSFR
is in frmInfo)? Perhaps there's Hide Me function that would keep one
user form open, just not shown on the screen giving the next form the
ability to link back to it. Any ideas?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Checkboxes, AND, OR statements

No link like a controlsource.

You can link with code in events

Userform1.cbox1.Value = Userform2.cbox3.Value

Userform1.hide

hides the userform but doesn't unload it so you can still access its
controls (read from and write to)

--
Regards,
Tom Ogilvy


wrote in message
ups.com...
Thanks, this looks great. Also, is there a way to link the check boxes
between 2 different user forms (say ckbCoast is in frmLocal and ckbSFR
is in frmInfo)? Perhaps there's Hide Me function that would keep one
user form open, just not shown on the screen giving the next form the
ability to link back to it. Any ideas?



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
Checkboxes stretch Excel Worksheet Functions 4 September 14th 07 12:36 PM
IF Statements (Mutliple Statements) Deezel Excel Worksheet Functions 3 October 19th 06 06:13 AM
checkboxes helpless101 Excel Worksheet Functions 0 April 10th 06 11:54 AM
operator statements, shorting when reusing one of the statements? KR Excel Programming 1 August 4th 05 06:20 PM
Checkboxes Thornsberry Excel Programming 1 November 11th 03 03:01 AM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"