ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check Box macro (https://www.excelbanter.com/excel-programming/400459-check-box-macro.html)

Patrick Bateman

Check Box macro
 
i am trying to run a macro from a button that is conditional on two check boxes

this is what i have so far;

Sub InitialBUTTON()



If ActiveSheet.CheckBoxes("CheckBox1").Value = True And
ActiveSheet.CheckBoxes("CheckBox2").Value = True Then

YESNO = MsgBox("Create Initial CHR for " &
Sheets("summary").Range("F7").Value & " " & _
Sheets("summary").Range("F8").Value & "?", vbYesNo + vbCritical,
"CHR Set Up")
Select Case YESNO
Case vbYes
Call INITIAL_CHR
Case vbNo
End Select

ElseIf ActiveSheet.CheckBoxes("CheckBox1").Value = True And
ActiveSheet.CheckBoxes("CheckBox2").Value = False Then
MechanicalCHRincomplete.Show

ElseIf ActiveSheet.CheckBoxes("CheckBox1").Value = False And
ActiveSheet.CheckBoxes("CheckBox2").Value = True Then
ElectricalCHRincomplete.Show

ElseIf ActiveSheet.CheckBoxes("CheckBox1").Value = False And
ActiveSheet.CheckBoxes("CheckBox2").Value = False Then CHRincomplete.Show

End If

End Sub


but i cant get it to work?

any help would be much appreciated.

Patrick


joel

Check Box macro
 

Sub InitialBUTTON()

If ActiveSheet.CheckBox1.Value = True And _
ActiveSheet.CheckBox2.Value = True Then

YESNO = MsgBox("Create Initial CHR for " & _
Sheets("summary").Range("F7").Value & " " & _
Sheets("summary").Range("F8").Value & "?", vbYesNo + vbCritical, _
"CHR Set Up")
Select Case YESNO
Case vbYes
Call INITIAL_CHR
Case vbNo
End Select

ElseIf ActiveSheet.CheckBox1.Value = True And _
ActiveSheet.CheckBox2.Value = False Then

MechanicalCHRincomplete.Show

ElseIf ActiveSheet.CheckBox1.Value = False And _
ActiveSheet.CheckBox2.Value = True Then

ElectricalCHRincomplete.Show

ElseIf ActiveSheet.CheckBox1.Value = False And _
ActiveSheet.CheckBox.Value = False Then CHRincomplete.Show

End If

End Sub
"Patrick Bateman" wrote:

i am trying to run a macro from a button that is conditional on two check boxes

this is what i have so far;

Sub InitialBUTTON()



If ActiveSheet.CheckBoxes("CheckBox1").Value = True And
ActiveSheet.CheckBoxes("CheckBox2").Value = True Then

YESNO = MsgBox("Create Initial CHR for " &
Sheets("summary").Range("F7").Value & " " & _
Sheets("summary").Range("F8").Value & "?", vbYesNo + vbCritical,
"CHR Set Up")
Select Case YESNO
Case vbYes
Call INITIAL_CHR
Case vbNo
End Select

ElseIf ActiveSheet.CheckBoxes("CheckBox1").Value = True And
ActiveSheet.CheckBoxes("CheckBox2").Value = False Then
MechanicalCHRincomplete.Show

ElseIf ActiveSheet.CheckBoxes("CheckBox1").Value = False And
ActiveSheet.CheckBoxes("CheckBox2").Value = True Then
ElectricalCHRincomplete.Show

ElseIf ActiveSheet.CheckBoxes("CheckBox1").Value = False And
ActiveSheet.CheckBoxes("CheckBox2").Value = False Then CHRincomplete.Show

End If

End Sub


but i cant get it to work?

any help would be much appreciated.

Patrick



All times are GMT +1. The time now is 10:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com