Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:35:28+00:00 2026-06-17T19:35:28+00:00

I have a spreadsheet, and I have written a macro which uses some of

  • 0

I have a spreadsheet, and I have written a macro which uses some of the values in the spreadsheet to output a text file. Everything works fine except one issue:

If I have a floating number like 15.0, it shows up in the output text file as integer 15, without the decimal point. I do not observe the same issue if the number after the decimal point is something other than zero, e.g., 15.1 gets written as 15.1; no problem there.

I wonder if there is some kind of a command or property, which would force all numbers are written to the output file as floating numbers?

This is the line I write the numbers to the text file. WeightList(i) and SpacingList(i) are string arrays, which are used for storing the numbers collected from the spreadsheet.

Print #1, Chr(9); "<truck axleW=" & Chr(34) & _
          WeightList(i) & Chr(34) & " axleS=" & _
          Chr(34) & SpacingList(i) & Chr(34) & "></truck>"

Thank you!

EDIT: This is the line where the numbers are converted to strings, I tried using the format command but this did not help:

WeightList(i) = Format("0.0", Truck(i).AxleWeights(i))

EDIT2: The code works now, after changing the order of the arguments in the format command. Please see the accepted answer for details.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:35:30+00:00Added an answer on June 17, 2026 at 7:35 pm

    You can use format(value,"0.0") to convert to a string with the desired sig figs.

    EDIT – sorry had order reversed…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written an Excel VBA macro which imports data from a HTML file
I have written a VBA macro in an excel spreadsheet that opens all workbooks
I have written some code for an excel spreadsheet. This sub has been added
I have written a simple Google Apps Spreadsheet script that takes details in some
Like many, I have spreadsheet that draws data from over 40 text files as
I have a spreadsheet I'm using to compile text that changes all the time.
I have an Excel spreadsheet that I have exported from some other program. It
I have an Excel spreadsheet that uses a TFS query to pull information on
I have written a short script that logs the time in a spreadsheet when
I have an application written in VB6 that writes data to a spreadsheet. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.