Andreas Hermle
asked on
check whether a range of cells contains a certain value using VBA
Dear Experts:
I got a form with Active X Control boxes.
In the below code only Range("F23") is checked whether it contains the boolean value 'False'.
I would like to expand the IF statement so that Range "F23" to Range "F30" is included, i.e. the IF statement is true
if any number of Cells (1 to 8) in the range "F23" to "F30" has the boolean value of 'False'.
Help is very much appreciated. Thank you very much in advance.
Regards, Andreas
I got a form with Active X Control boxes.
In the below code only Range("F23") is checked whether it contains the boolean value 'False'.
I would like to expand the IF statement so that Range "F23" to Range "F30" is included, i.e. the IF statement is true
if any number of Cells (1 to 8) in the range "F23" to "F30" has the boolean value of 'False'.
Help is very much appreciated. Thank you very much in advance.
Regards, Andreas
Sub Check_for_value_in_a_range()
If ActiveSheet.OLEObjects("chbx_GenSurg").Object.Value = True And ActiveSheet.Range("F23").Value = False Then
ActiveSheet.OLEObjects("chbx_GenSurg").Object.Value = False
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great job, thank you very much. Will shortly post a similiar question.
Regards, Andreas
Regards, Andreas
ASKER
Regards, Andreas