+ Reply to Thread
Results 1 to 3 of 3

VBA output - force trailing zeros

  1. #1
    Registered User
    Join Date
    11-06-2014
    Location
    DFW
    MS-Off Ver
    Old
    Posts
    4

    VBA output - force trailing zeros

    Good morning everyone,

    I have an excel VBA application I need some direction on.

    I'm calculating values in Excel based on formulas, then printing the results to a text file.

    My VBA command looks like this:

    Please Login or Register  to view this content.
    however, in Excel, if my formula calculates a whole number displayed as 1.000 in the cell - formatted as a number. If formatted as text it displays 1 without decimal. Regardless, the above VBA function prints X1 where I need the output to hold the decimal place. Precision isn't a concern, but holding the decimal place is.

    Any help is greatly appreciated.

    Thank you

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA output - force trailing zeros

    Try
    Please Login or Register  to view this content.
    Format is the VBA equivalent of the worksheet function TEXT.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    11-06-2014
    Location
    DFW
    MS-Off Ver
    Old
    Posts
    4

    Re: VBA output - force trailing zeros

    that worked. Already adapted it to my VBA code!

    Thanks a million!

+ 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] Keep trailing zeros, but only if they're there...
    By rbrian in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 12-02-2013, 10:47 AM
  2. [SOLVED] Add Trailing Zeros
    By sweetkel23 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-07-2012, 01:42 AM
  3. Replies: 5
    Last Post: 04-09-2012, 02:28 PM
  4. How to force the display of trailing zeros in variables?
    By proepert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2011, 11:53 PM
  5. trailing zeros
    By htorres in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-23-2007, 03:00 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