+ Reply to Thread
Results 1 to 5 of 5

VB Code to change format, save in notepad file

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to change format, save in notepad file

    Hello:

    Please refer to attached file.
    I have data in excel sheet as shown in column K
    I need VB Code to go thru each row of data and do the following:
    1. Go thru each cell in column K and if it finds numeric number then format that number to 2 decimal places
    For example K26 has value 14, change the format so that it displays 14.00

    2. Go thru each cell in column K and if it finds numeric negative value then add "$" in front of
    numeric number..
    Example K7 is -232.15, change to $-232.15

    3. Copy column K into notepad file and save as C:\Temp\Test.qif

    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VB Code to change format, save in notepad file

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VB Code to change format, save in notepad file

    Hello Riz,

    Here is another macro to save the data as aNotepad file.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to change format, save in notepad file

    Hi AlphaFrog and Leith:

    Code works good, need small modification.

    Go thru each cell in column K and if it finds numeric positive value then add "$" in front of
    numeric number..
    Example K29 is 14.39, change to $14.39

    Also the location and file name to be saved as QIF will be in Cell L1 so pick up from here

    Please let me know if you have any questions.
    Thanks.

    Riz

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VB Code to change format, save in notepad file

    Hello Riz,

    You're usually pretty good at making changes to simple code. I was hoping you could make the changes to my macro yourself.

    Here is the revised macro code...
    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. [SOLVED] Save Notepad through VBA Macro, having Copied Range of Cells, Pasted into notepad
    By analystbank in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-22-2014, 02:14 AM
  2. Repost - Shell Wait for Notepad to open file and Save
    By jimrosser in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-13-2014, 11:06 AM
  3. VBA Code to Save Excel File As Semi-Colon Delimited Format
    By mab1284 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2014, 09:52 AM
  4. Replies: 3
    Last Post: 02-04-2013, 12:18 PM
  5. Replies: 1
    Last Post: 01-16-2013, 02:02 AM
  6. How to save the opened word document as a Notepad/text file?
    By Rahul888 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-10-2012, 05:38 PM
  7. Replies: 1
    Last Post: 08-30-2009, 11:26 AM

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