Calculating hours in a textbox

  • Dear Ozgrid,


    I have a Textbox1 with value = 5:52 in format time (5 hours and 52 minutes)
    And I want to multiply it with 47 with assumption 1 hours = 47 liters
    The total consumption should be 5.87 * 47 = 275.73 liters
    Total Consumption = TextBox2


    Below the function when I try to exercise:
    - multiply hours (5:52) with 24 = 5.87
    - then multiply 5.87 with 47 = 275.73 liters


    But when I try in VBA, the result is not correct


    It gave me zero when I use this code

    Code
    TextBox2.Value = Format(TextBox1.Value, "0,00") * 24 * 47
       TextBox2.Value = Format(TextBox1.Value, "0.00")


    Need your help and assistance to guide me to fix the code


    Thank you
    prima

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!