+ Reply to Thread
Results 1 to 3 of 3

changing the value format problem

  1. #1
    Registered User
    Join Date
    08-05-2015
    Location
    Poland
    MS-Off Ver
    2010
    Posts
    9

    changing the value format problem

    Hi Guys,
    I have the following challenge.
    Everyday I receive a text file (uploaded automatically to the catalog C:\Users\aa\Desktop\files
    They are automatically imported by another program and here is a problem: Format of the files have changed (before values had 2 decimal places like 100.10 USD and new files have four decimal places like 100.1010 USD).
    Program that imports that data cant understand the new format and is unable to do rounding and I receive ERROR.

    My idea is as follows.
    1. Create macro that automatically imports the data from this catalog to xls
    2. Performs the rounding to 2 decimal places
    3. Exports the file to the txt format with 2 decimal places
    4. Run that macro from Windows scheduler at a certain time

    I belive it is as easy as ABC isn't it?

    txt file structure:

    No Time Value
    1 1-Jan 12323.2121
    2 1-Jan 22323.3132
    3 1-Jan 32323.5142
    4 1-Jan 11323.2111
    5 1-Jan 323.7101

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,313

    Re: changing the value format problem

    Hi.
    You say you receive file as text, do we read this to mean .csv ?
    e.g. No,Time,Value
    1,1-Jan,12323.2121
    A good start would be a copy of two or three lines of actual file that is uploaded, including all headers.
    torachan.

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: changing the value format problem

    If the only purpose of importing to Excel is to perform rounding, you could just manipulate the text file directly using vbscript.
    Assuming the data is delimited by a space:

    Copy to Notepad and save as filename.vbs

    Please Login or Register  to view this content.

+ 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. Changing Cell format based on another cells format.
    By MrStevie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2017, 03:02 PM
  2. [SOLVED] Problem with formula changing the cel number format
    By SL_Mills in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-07-2016, 02:19 PM
  3. Importing data - problem with changing date format!
    By highlystrung in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2013, 11:44 AM
  4. [SOLVED] Having a problem changing date format
    By ns5622 in forum Excel General
    Replies: 4
    Last Post: 05-29-2013, 01:45 AM
  5. Changing numbers from text format to number format
    By garden_gnome in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2012, 12:48 PM
  6. Replies: 18
    Last Post: 03-07-2007, 05:52 AM
  7. Cell Format problem, not changing
    By davidbeecken in forum Excel General
    Replies: 1
    Last Post: 06-17-2005, 06:05 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