Excel inputbox ?

Robertson1995

Board Regular
Joined
Apr 1, 2009
Messages
121
Trying to add a Celsius to Farenheit converter. What I would like to do is have an inputbox for the user to enter Celsius and then take the Celsius # entered and multiply times 1.8 and then add 32 and then have the result show in a Msgbox. Thanks in advance for any help.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Fortunately, there's already a built in function to do that for you...

=CONVERT(A1,"C","F")


This does require the Analysis Toolpack from Tools - Addins
If you have XL2007 or higher, it's already installed.


Hope that helps.
 
Upvote 0
Try

Code:
Sub degrees()
Dim C As Double
C = Application.InputBox("Enter 'C", Type:=1)
MsgBox "Temp in 'F = " & C * 1.8 + 32
End Sub

Also look at CONVERT in the Analysis Toolpak.
 
Upvote 0
Hi,

How about this?

Code:
    Dim dblTemp As Double
    
    On Error GoTo Finish
    
    dblTemp = InputBox(Prompt:="Please enter your desired temperature in Celsius to convert!")
    MsgBox Prompt:=(dblTemp * 1.8) + 32, _
           Buttons:=vbQuestion, _
           Title:="Result"
    Exit Sub
    
Finish:
    MsgBox Prompt:="Please only enter your temperature in celsius (No Text)!", _
           Buttons:=vbCritical, _
           Title:="Error"
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top