+ Reply to Thread
Results 1 to 12 of 12

VB Code to convert number

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to convert number

    Hello:

    Please refer to attached file.
    I have data in Cell J5:J10.
    I need all these data to convert to 2 decimal.
    As you can see cell J2 has value of 43680.103581584.

    Let me know if you have any questions.
    Thanks.
    Riz
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VB Code to convert number

    Hi,

    Do you need to convert them or just SEE two decimal places.

    If the former then convert with =ROUND(J6,2) then copy and paste back as values.
    If the latter then just format the cells to show 2 dec. pl.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VB Code to convert number

    why cant you just use round function?
    =TEXT(ROUND(J5,2),"#.00")
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to convert number

    Hello:

    I need simple VB code to incorporate with my existing code.
    Code needs to check each of the cell value and trim it to 2 decimal.
    Please let me know if you have any questions.
    Thanks.

    Riz

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VB Code to convert number

    trim or round?
    two different things

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to convert number

    Hello:

    Need to convert so Round off..
    Thanks

    Riz

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to convert number

    Hello:

    Need to convert so Round off..
    Thanks

    Riz

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VB Code to convert number

    Hello Riz,

    Here you go,

    Please Login or Register  to view this content.
    Kind Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  9. #9
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VB Code to convert number

    Please Login or Register  to view this content.

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VB Code to convert number

    @ humdingaling,

    Your Code will wipe all formulas, if any, in the specified range.

    Personally, I don't believe it is advisable to go down that route.

    Kind Regards.

  11. #11
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to convert number

    Hello Winon & humdingaling :

    I think the result i need is getting from humdingaling.
    Both thanks a lot..

    Riz
    Last edited by rizmomin; 01-25-2017 at 09:23 AM.

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VB Code to convert number

    Hello rizmomin,

    Thank you for the feedback, and the "Rep".

    Glad we could help!

    Regards.

+ 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. Need formula or code to convert number(s) from custom format to number format
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-12-2015, 07:44 PM
  2. [SOLVED] vba code to convert 'n' number of dataset into tables automatically.
    By Ishwarind in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-20-2014, 04:08 AM
  3. [SOLVED] Convert a fixed function (hard code row number) with embedded functions to last Row Functi
    By markDuffy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2013, 12:47 PM
  4. VBA Code Help - Convert to Number
    By jeff01010 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2011, 11:39 AM
  5. Convert Text to a Number - VB Code Needed
    By SEOT in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-28-2008, 06:21 PM
  6. Code to convert text input to a number
    By FCC in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2006, 05:00 AM
  7. Convert text strings to a code or number
    By MaxNY23 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-23-2006, 06:50 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