(Solved) – Setting condition in excel VBA

  • by
(solved)-–-setting-condition-in-excel-vba

I am trying to create a condition for the VBA where the user can place value in the excel and i would calculate the value in to percentage. I have already set for if value is more than 100% but i tried to put when OVP1=1 the code does not work. How do i set such that the value that i get can be set that it cannot lower than 100% nor more than 100%

Public Sub OVP()

    If Sheet1.OVP.Value = True Then
    M = Sheet1.P.Value / 100
    B = Sheet1.T.Value / 100
    O = Sheet1.C.Value / 100
    OVP1 = M   B   O
    MepoP = 1
    BenraP = 1
    OmaP = 1
    End If

    If Sheet1.OVP.Value = True And OVP1 > 1 Then
    MsgBox "Please check the percentages"
    End If

Leave a Reply

Your email address will not be published. Required fields are marked *