+ Reply to Thread
Results 1 to 8 of 8

VBA centigrade to fahrenheit - farenheit to centigrade

  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.

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 02-26-2019 at 04:16 PM. Reason: Added Code Tags

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,108

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    It has to be handed in by tomorrow
    Homework?
    Whenever you have 2 = signs in one line of code the first part fill simply read true or false depending on whether the 2nd & 3rd are =

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

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    I know right? I'm thinking of it as using my initiative rather than cheating!...did think that but when I remove = it says compile error or syntax error

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    As Fluff13 said, a statement like
    Answer = Centigrade = 5 / 9 * Fahrenheit - 32

    Means that Answer equals the comparison between Centigrade and 5 / 9 * Fahrenheit - 32

    In the CtoF code you don't need Number2... it does not matter what Fahrenheit value is in the box, since you are planning to overwrite it anyhow.

    I believe what you need to calculate Answer in C to F is:
    Please Login or Register  to view this content.
    since Number1 is your Celsius value, and you multiply that by 5/9 then add 32 to do the conversion to F?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,108

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    You could also look at using the worksheet function CONVERT
    Please Login or Register  to view this content.

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

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    I have changed code but if I input 25 C which should be 77 F its coming out as 45 F and if I put in 77 F I'm getting a 0 return C?

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

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    Got It!! Thankyou so much.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,108

    Re: VBA centigrade to fahrenheit - farenheit to centigrade

    Glad we could help & thanks for the feedback

+ Reply to Thread

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