+ Reply to Thread
Results 1 to 2 of 2

Adjust Decimal Places in a Macro

  1. #1
    Registered User
    Join Date
    12-10-2015
    Location
    Houston, Texas
    MS-Off Ver
    2010
    Posts
    1

    Adjust Decimal Places in a Macro

    I'm trying to automate a task where I have a column of numbers with varying lengths and need to set the whole column to the same amount of decimal places as the longest number, and then add a trailing zero to every number.

    Example
    -7.56
    0
    -13.50
    0.1546879

    Would turn into
    -7.56000000
    0.00000000
    -13.50000000
    0.15468790

    This, unfortunately, means I cant simply set the column to a specific decimal place format and forget about it because it's different every time.

    I was trying to experiment with setting up some kind of formula array using MAX(LEN(range)) and then somehow taking that variable (+1) and using it to assign the decimal places somehow but I'm currently stumped.

    Anyone have a solution for this problem?

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Adjust Decimal Places in a Macro

    Hi Maxnell,

    Welcome to the Forum!

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ 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. Adusting decimal places based on greatest number of places in a series
    By anelson87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2022, 01:05 PM
  2. Replies: 2
    Last Post: 12-29-2013, 08:37 PM
  3. [SOLVED] Calculating decimal places in a non decimal format (ie sixes not tens)
    By Mike Brewer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-07-2013, 08:58 AM
  4. Replies: 4
    Last Post: 12-26-2012, 05:37 AM
  5. Macro doesnt read 2 decimals places after decimal when it is a .00
    By betboy25 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2012, 03:57 PM
  6. Paste two decimal number in excel without extra decimal places appearing
    By jeffery_frick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 07:49 PM
  7. Replies: 4
    Last Post: 06-10-2009, 12:50 PM
  8. Replies: 3
    Last Post: 07-06-2005, 09:05 AM

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