none
vba variable problem RRS feed

  • Question

  • hello,

    i have a problem with variables..i want to get any value to a variable and then compare it...but when a function in the cell doesn´t find a value but "#N/A" it is a problem...can you help solve this issue please???

    here is the code and the function is "INDEX(RATES!$L$8:$BA$15377,MATCH(Calculator!$C12,RATES!$A$8:$A$15377,0),MATCH(Calculator!$C11,RATES!$L$7:$BA$7,1))"

    Private Sub CommandButton1_Click()
        Baseprice = Range("C14")
        If Baseprice = 0 Then
            MsgBox "Daná destinácia nie je v cenniku! Prosím zadajte inú destináciu."
        End If
        JitSurcharge = Worksheets("Special Surcharges").Range("C29")
        TeamDriverFlatFee = Worksheets("Special Surcharges").Range("C30")
        TruckWithTailiftSurcharge = Worksheets("Special Surcharges").Range("C31")
        TruckWithTailiftSurchargeDTAG = Worksheets("Special Surcharges").Range("C32")
        TruckWithCraneSurcharge = Worksheets("Special Surcharges").Range("C33")
        AdditionalDropOfflociationSurcharge = Worksheets("Special Surcharges").Range("C35")
        If CheckBox1.Value = True Then Range("C16") = Baseprice * JitSurcharge
        If CheckBox2.Value = True Then Range("C17") = Worksheets("Special Surcharges").Range("C30")
        If CheckBox3.Value = True Then Range("C18") = Baseprice * TruckWithTailiftSurcharge
        If CheckBox4.Value = True Then Range("C19") = Baseprice * TruckWithTailiftSurchargeDTAG
        If CheckBox5.Value = True Then Range("C20") = Baseprice * TruckWithCraneSurcharge
        If CheckBox6.Value = True Then Range("C21") = Worksheets("Special Surcharges").Range("C35")
        If CheckBox7.Value = True Then Range("C22") = "=SUM(C14,C15:C20)*$C$13"
        If CheckBox1.Value = False Then Range("C16") = 0
        If CheckBox2.Value = False Then Range("C17") = 0
        If CheckBox3.Value = False Then Range("C18") = 0
        If CheckBox4.Value = False Then Range("C19") = 0
        If CheckBox5.Value = False Then Range("C20") = 0
        If CheckBox6.Value = False Then Range("C21") = 0
        If CheckBox7.Value = False Then Range("C22") = 0
    End Sub

    thank you...

    Mathew

    Friday, September 27, 2013 7:36 AM

All replies