Results 1 to 8 of 8

VBA centigrade to fahrenheit - farenheit to centigrade

Threaded View

  1. #1
    Registered User
    Join Date
    12-17-2018
    Location
    gloucester
    MS-Off Ver
    2016
    Posts
    17

    VBA centigrade to fahrenheit - farenheit to centigrade

    I have 2 labels (C and F) 2 textbox (TextC and TextF) and 2 command buttons (CtoF and FtoC)
    I have put in the following code but keep getting 0 as result in both no matter what text box or command button I use or what temperature I enter.
    The idea is for user to input temp in Centigrade textbox and fahrenheit to show and visa versa
    I know its going to be something I've done that's silly but It has to be handed in by tomorrow and I've been playing with it for three days.

    Private Sub cmdCtoF_Click()
    Dim Number1 As Double
    Dim Number2 As Double
    Dim Answer As Double
    Number1 = Val(txtC.Text)
    Number2 = Val(txtF.Text)
    Answer = Centigrade = 5 / 9 * Fahrenheit - 32
    txtF.Text = Int(Answer)
    End Sub
    
    Private Sub cmdFtoC_Click()
    Dim Number1 As Double
    Dim Number2 As Double
    Dim Answer As Double
    Number1 = Val(txtC.Text)
    Number2 = Val(txtF.Text)
    Answer = Fahrenheit = 9 / 5 * Centigrade + 32
    txtC.Text = Int(Answer)
    End Sub
    Last edited by Leith Ross; 02-26-2019 at 04:16 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Centrigade to Fahrenheit function
    By nav505 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2013, 01:20 PM
  2. Command button to toggle Celsius (°C) and Fahrenheit (°F) conversion
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-13-2012, 05:29 PM
  3. auto conversion from celcius to fahrenheit for entire column
    By dj59 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-13-2012, 10:33 AM
  4. [SOLVED] Customize Supercsript, e.g. word Centigrade to be oC, o superscri
    By Porini in forum Excel General
    Replies: 1
    Last Post: 05-01-2006, 05:16 AM
  5. [SOLVED] Convert farenheit to celcius
    By Lisa in forum Excel General
    Replies: 6
    Last Post: 09-29-2005, 03:05 PM
  6. What is the formula for converting farenheit to celsius?
    By JE McGimpsey in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 09-06-2005, 04:05 AM
  7. [SOLVED] Need to convert temperature from Farenheit to Celsius
    By Sam in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-13-2005, 12:06 PM
  8. Convert Farenheit to Celcius
    By kndfrnd in forum Excel General
    Replies: 4
    Last Post: 01-26-2005, 03:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1