×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Writing a number from a cell into a text file

Writing a number from a cell into a text file

Writing a number from a cell into a text file

(OP)
Hi,

I am trying to prepare a text file from a portion of my spreadsheet. But, I have some issues with format of numbers.

For example, I have a number like 3.0 in a cell of my spreadsheet, when my VB subroutine writes this number, I will get 3 instead of 3.0. But, I really need to have 3.0 in the text file, because it is an input file for another program. I guess that there should be a command in VB to control the format of numbers during writing the external file. I appreciate to have your help.

A.A.Y.

RE: Writing a number from a cell into a text file

Try using Range.Text instead of Range.Value.

RE: Writing a number from a cell into a text file

Or you could do something like: Format(<cell value>,"#.##")

The MSDN site has the exact syntax but as long as the value returned by the cell is a number this should work. I think ;) It's been a while since I've done something like this.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources