Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-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

*Tek-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


Excel VBA

Excel VBA

Excel VBA

I am fairly new to VBA and using code in Excel. I have achieved quite a bit but I am stuck on many different areas that I need to clean up in order to make this work.

Goal: I need to send an excel file to a txt file for a testing procedure.

My first issue I need to resolve is the decimal is showing in my text file. Some of the figures in my excel spreadsheet have decimals. The catch to this is some of them can only be dollar amounts (even though there might be cents) and some can have both - no rounding and no decimal allowed in txt file.

If someone can provide me with what will be helpful for me to attach to this I will.

RE: Excel VBA

What is the mathematical function envisioned to remove decimals without rounding?

RE: Excel VBA

Hi, and welcome to Tek-Tips. You'll find a wealth of information from just searching and browsing this forum and others here at TT.

You're going to need to create another sheet, so as not to destroy the data you have on this sheet, that truncates your decimal data. You can use the INT() function. You know how many rows and columns you need. You might use a formula like this, assuming that your table is in Sheet1 beginning at A1...


Copy and then Paste across & down on your new sheet

This does not address any field delimiters you might need on a delimited text file or space padding that you might need on a fixed width text file when you SaveAs to some sort of text file.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Excel VBA

That formula worked great for the cells that I only needed dollar amounts. For the cells I needed to keep the cents and not round, it took that amount and rounded it.

RE: Excel VBA



glassesJust traded in my OLD subtlety...
for a NUance!tongue

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 Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

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

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

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close