Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
AND/OR in Macro
Do I follow the same format in a macro as I do in a spreadsheet for the
following? IF(AND(test1, test2)) If not, what would be the correct way to test the value of multiple fields. I wanted to test the value of optionbutton1 and optionbutton 2 and if either were TRUE, THEN........... Thanks, Les |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
AND/OR in Macro
If Me.OptionButton1 Or Me.OptionButton2 Then
MsgBox "both checked" Else MsgBox "none checked" End If -- Dan On Jan 9, 8:51*am, WLMPilot wrote: Do I follow the same format in a macro as I do in a spreadsheet for the following? IF(AND(test1, test2)) If not, what would be the correct way to test the value of multiple fields.. I wanted to test the value of optionbutton1 and optionbutton 2 and if either were TRUE, THEN........... Thanks, Les |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
AND/OR in Macro
If test1 or test2 = true then...is valid, but generally better to be more
specific, If test1=true or test2=true then.. both of these are valid -- -John Please rate when your question is answered to help us and others know what is helpful. "WLMPilot" wrote: Do I follow the same format in a macro as I do in a spreadsheet for the following? IF(AND(test1, test2)) If not, what would be the correct way to test the value of multiple fields. I wanted to test the value of optionbutton1 and optionbutton 2 and if either were TRUE, THEN........... Thanks, Les |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
AND/OR in Macro
Take a look at the "And Operator" topic in VBA Help...
If OptionButton1.Value And OptionButton2.Value Then .... In article , WLMPilot wrote: Do I follow the same format in a macro as I do in a spreadsheet for the following? IF(AND(test1, test2)) If not, what would be the correct way to test the value of multiple fields. I wanted to test the value of optionbutton1 and optionbutton 2 and if either were TRUE, THEN........... Thanks, Les |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
AND/OR in Macro
No, the use is more in keeping with natural languages:
If Myvar 0 And Myvar < 10 then .... best wishes -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "WLMPilot" wrote in message ... Do I follow the same format in a macro as I do in a spreadsheet for the following? IF(AND(test1, test2)) If not, what would be the correct way to test the value of multiple fields. I wanted to test the value of optionbutton1 and optionbutton 2 and if either were TRUE, THEN........... Thanks, Les |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
AutoRun Macro with a delay to give user the choice to cancel the macro | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |