mercredi 19 février 2020

If with multiple ands, nested ifs, or ifs with booleans?

I have tried these multiple ways, and I still am not getting the result I need. I have a UserForm with multiple checkboxes. If two checkboxes are checked, I want one answer, but if the third checkbox is checked, a separate answer. What is the correct way to do this? Nested Ifs:

Dim Cost As Range, SetUpCost As Range, Prices As Range
Set Cost = WB.Worksheets("Calculations").Range("F42")
Set Prices = WB.Worksheets("Calculations").Range("D42")

If QuarterlyCheck = True And SecurityLite = True Then
If NoSetUpCheck = False Then
    SecurityLitePrice.Caption = "$" & Cost.Value * 4
    SetUpFee.Caption = "$" & SetUpCost.Value
End If
ElseIf NoSetUpCheck = True Then
    SecurityLitePrice.Caption = "$" & Prices.Value * 4
    SetUpFee.Caption = ""
End If

Or multiple ifs:

If QuarterlyCheck = True And SecurityLite = True And NoSetUpCheck = False Then
    SecurityLitePrice.Caption = "$" & Cost.Value * 4
    SetUpFee.Caption = "$" & SetUpCost.Value
End If
If QuarterlyCheck = True And SecurityLite = True And NoSetUpCheck = True Then
    SecurityLitePrice.Caption = "$" & Prices.Value * 4
    SetUpFee.Caption = ""
End If

Neither are getting me the result I need.

Aucun commentaire:

Enregistrer un commentaire