View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default if statement in an if statement

This code that you posted works fine for me

If Userform1.Checkbox1.Value = True And Userform1.Checkbox2.Value = True And
Userform1.Checkbox3.Value = True Then
Run something


Are you sure you are referencing the correct checkbox control??



"meiftan" wrote:

Dears,
I have a trouble in using if statement in macro, hope someone with
"Excel"ent mind answer my question, sorry for my bad English.

Here's the macro in my mind,

If Userform1.Checkbox1.Value = True (If "AND" Userform1.Checkbox2.Value =
True(If "AND" Userform1.Checkbox3.Value)) Then
Run something

I used this before,

If Userform1.Checkbox1.Value = True And Userform1.Checkbox2.Value = True And
Userform1.Checkbox3.Value = True Then
Run something

But when the Checkbox2.Value = False , It doesn't work , I changed AND to
OR, same result, the point is when the value = False, then non-activate that
condition.

Regards,