+ Reply to Thread
Results 1 to 7 of 7

Cell is converting my numbers from floating to integers... Help?

Hybrid View

Aristizabal95 Cell is converting my numbers... 07-03-2013, 01:37 AM
AlphaFrog Re: Cell is converting my... 07-03-2013, 01:51 AM
Aristizabal95 Re: Cell is converting my... 07-03-2013, 02:00 AM
Aristizabal95 Re: Cell is converting my... 07-24-2013, 08:28 PM
AlphaFrog Re: Cell is converting my... 07-24-2013, 08:54 PM
Aristizabal95 Re: Cell is converting my... 07-24-2013, 10:35 PM
AlphaFrog Re: Cell is converting my... 07-24-2013, 10:45 PM
  1. #1
    Registered User
    Join Date
    07-01-2013
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Unhappy Cell is converting my numbers from floating to integers... Help?

    Im having trouble with my project. I've made some simple math through VBA coding, so that the user can input the width and the height of a square, and it outputs the area of the square. Now, that value is shown in a textbox, and it shows both integers and float values. But when I try to output the same value to a cell, it reaches a point where it just takes out the comma, converting the number into a messy integer. ie: desired value: 7,7244 value shown in cell 77244. I thought I could do something by creating a double variable and outputting the value converted to double into the cell, but now the value is getting rounded. Any clues on what happened? Or how to solve it?
    Thanks!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Cell is converting my numbers from floating to integers... Help?

    • Right-click on the output cell
    • Select Format Cells on the pop-up context menu
    • On the Number tab, select the category Number and check the Thousands Separator checkbox

    Alternativly, in your vba code you can set the output cell's number formatting.
    outputcell.NumberFormat = "#,##0.00"

  3. #3
    Registered User
    Join Date
    07-01-2013
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Cell is converting my numbers from floating to integers... Help?

    Worked perfectly! Thanks a lot!

  4. #4
    Registered User
    Join Date
    07-01-2013
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Cell is converting my numbers from floating to integers... Help?

    Im having a new trouble regarding the same question: I just finished my work and gave it to my boss, he placed it in his computer to find out that my textboxes were taking a float number from a cell and showing the whole number as an integer, which is a really bad problem since what should be $413,45 ends up being $413.457.342.638.132,00. The number changes depending on the user's choices, so I can't just put a constant. What's strange is that it works perfectly in my computer, but it's messy on his! This means that the error is not on the code but on his pc configuration. I have my boss' computer here, looking for anything that may make sense to me, but I'm not sure what could lead to this problem.

    Also, I already tried the solution above, but doesn't work this time. Im pretty sure it has to be with my boss' computer configuration since I have no errors in my computer neither my sister's.
    Thanks a lot

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Cell is converting my numbers from floating to integers... Help?

    Check your boss's Windows Control Panel\ Regional and Language Options
    Make sure he has selected a region (e.g.; Spanish-Columbia) where commas are used for decimal point.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  6. #6
    Registered User
    Join Date
    07-01-2013
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Cell is converting my numbers from floating to integers... Help?

    Worked! Thanks a lot!

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Cell is converting my numbers from floating to integers... Help?

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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