Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick VBA code question (if...then statement)

How would i write in VB code:

if checkbox1, checkbox2, and checkbox3 all equal false then Unload me
else finish going thru the rest of the code.

I just don't know how to 'ask' "if [multiple things] then" in VB

thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Quick VBA code question (if...then statement)

If checkbox1.value = false and checkbox2.value = false and
checkbox3.value = false then
unload me
End If

If all the criteria isn't met, the "unload me" will be
skipped and the code following the "end If" will execute.

-----Original Message-----
How would i write in VB code:

if checkbox1, checkbox2, and checkbox3 all equal false

then Unload me,
else finish going thru the rest of the code.

I just don't know how to 'ask' "if [multiple things]

then" in VB

thanks


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick VBA code question (if...then statement)

abxy

try something like this

with userform1
if .checkbox1 and .checkbox2 and .checkbox3 = False then
unload me
exit sub ''this stops the macro
end if
end with

HTH

Charle

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Quick VBA code question (if...then statement)

I would use

If Not Checkbox1.Value Then
If Not Checkbox2.Value Then
If Not Checkbox3.Value Then
Unload Me
End If
End If
End If

This way, if 1 or 2 is set, the remaining tests are not executed.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"abxy " wrote in message
...
How would i write in VB code:

if checkbox1, checkbox2, and checkbox3 all equal false then Unload me,
else finish going thru the rest of the code.

I just don't know how to 'ask' "if [multiple things] then" in VB

thanks


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick VBA code question (if...then statement)

This worked, thanks guys! big help


---
Message posted from http://www.ExcelForum.com/



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
Quick Question Dave Excel Discussion (Misc queries) 3 February 18th 09 06:00 PM
Quick Question N.F[_2_] Excel Discussion (Misc queries) 1 July 2nd 07 10:38 PM
quick question riggi Excel Discussion (Misc queries) 4 January 31st 07 06:11 AM
Quick Code Nimish Excel Discussion (Misc queries) 3 September 11th 06 07:19 PM
Is there a quick way to see which objects have code attached? Terri[_4_] Excel Programming 2 September 12th 03 05:11 PM


All times are GMT +1. The time now is 05:25 AM.

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"