I need help writing a code that will:
I know the basic formulas for converting from one to another:
F = ((9/5)*C) + 32
C = (5/9)*(F - 32)
Just not sure how you would go about having the program determine whether or not the user inputted a temp in C or F and then how to get it to choose the correct formula.
Sub TempConvertor()
Dim Temp As Double
Dim F As Integer
Dim C As Integer
Temp = InputBox("Enter a temperature as well as F (for fahrenheit) or C (for Celcius)")
F = ((9 / 5) * C) + 32
C = ((5 / 9) * (F - 32))
MsgBox (Temp)
End Sub
There's where I am at so far, which I know is way off
- Ask the user for input temperature (numerical value) and temperature type (Celsius/Fahrenheit).
- Convert the temperature to Fahrenheit/Celsius depending on the input. If the given temperature is in Fahrenheit, convert it to Celsius and vice-versa.
- Display the result in a message box.
I know the basic formulas for converting from one to another:
F = ((9/5)*C) + 32
C = (5/9)*(F - 32)
Just not sure how you would go about having the program determine whether or not the user inputted a temp in C or F and then how to get it to choose the correct formula.

Sub TempConvertor()
Dim Temp As Double
Dim F As Integer
Dim C As Integer
Temp = InputBox("Enter a temperature as well as F (for fahrenheit) or C (for Celcius)")
F = ((9 / 5) * C) + 32
C = ((5 / 9) * (F - 32))
MsgBox (Temp)
End Sub
There's where I am at so far, which I know is way off
