+ Reply to Thread
Results 1 to 20 of 20

VB Code to transfer some data from excel to txt file

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

    VB Code to transfer some data from excel to txt file

    Hello:

    Please refer to attached file.
    I need to create txt file following manner from the data in Sheet1 as below.

    For each employee there will be set of data which needs to be in the format shown in attached txt file. Employee name is in column C.


    Line 1 : !Type:Bank
    Line 2 : Date in column A for new employee. (D12/14/2016)
    Line 3 : Find "NET PAY in Column E and put the value from column F (T-629.80)
    Line 4 : Check # as in Column B (N1554)
    Line 5 : Employee Name (PALI Momin)
    Line 6 : Text from column D (SPayroll:Gross)
    Line 7 : Text from column E (Spayroll:Taxes)
    Line 8 : Text from column F ($-800)
    Now need to skip Date,Check# and Employee Name until next employee

    Line 9 : Text from column D (SPayroll:Taxes)
    Line 10 : Text from column E (Esocial Security - Company)
    Line 11 : Text from column F ($-49.6)

    And so on…until the next employee.
    There needs to be ^ character after each employee (before the start of new employee.

    I have attached text file with this to understand.

    Please let me know if any questions.
    Thanks

    RM
    Attached Files Attached Files

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

    Re: VB Code to transfer some data from excel to txt file

    Hello:

    Please use atatched txt file for referance.
    Thanks
    RM
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    See if this is how you wanted.
    Please Login or Register  to view this content.

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

    Re: VB Code to transfer some data from excel to txt file

    Hi Jindon:

    Looks like working, i will do more testing and may need little tweaking to complete.
    Will let you know for sure.
    Once again thank you so much for such a great help.
    RM

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

    Re: VB Code to transfer some data from excel to txt file

    Hello jindon:

    Needs little tweaking as follows.
    Please refer to attached files.
    I have attached file and look at Sheet3 to show you how txt file should be.
    On that Sheet3, column B, i have pit some explanation which will help you understand.

    I have included the txt file which is how it needs to be.

    Also i have put the name and location of the file which needs to be saved at Sheet1, cell I1

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

    RM
    Attached Files Attached Files

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

    Re: VB Code to transfer some data from excel to txt file

    Hi Jindon:

    After careful reviewing following changes are needed.
    !TYPE:Bank ......ONLY NEED ONCE AT THE BEGINING OF THE FILE.
    At the end of each employee need "^" character....not forgetting only 1 ^ character at the end of file.
    Save the file as shown in the location I1.
    I think this should do it.
    PLEASE REVIEW the files i have attached earlier
    Please let me know if you have any questions.
    Thanks.

    Riz
    Last edited by rizmomin; 12-16-2015 at 12:10 PM.

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

    Re: VB Code to transfer some data from excel to txt file

    Hi JinDon:

    Also would like to point out that each of the column of data have formulas in it so can you please code so that the formula is not affected.
    Thanks and let me know if any questions.
    Riz

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    Try this one.
    Please Login or Register  to view this content.

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

    Re: VB Code to transfer some data from excel to txt file

    Hello Jindon:

    Thanks for the update.
    Still some problems.
    Have a look at attached excel file and txt file.
    I have highlighted showing the data for 2 employees.
    For this file
    Row 1 to 17 belongs to Angela Momin highlighted yellow.
    Row 18 to 13 belongs to Humazehra Momin highlighted gold.

    1st you need to get Net Pay for each employee.
    Then you need to complete all data pass Net Pay if the employee data is there.
    Your code is thinking to have new employee after Net Pay.
    Its liitle difficult to explain but i have atatched the corrected txt file which how it needs to be.
    Have a look and let me know if any questions.
    Thanks
    RM
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    Now confusing.
    Second person in your text file only has

    D12/16/2016
    T-683.89
    N1001
    PHumazehra N.Momin
    SPayroll:Gross
    ERegular Hourly Wages
    $-825
    SPayroll:Taxes
    ESocial Security - Company
    $-51.15
    SPayroll:Taxes
    EMedicare - Company
    $-11.96
    SPayroll:Taxes
    EFederal Unemployment Insurance
    $-4.95
    SPayroll:Taxes
    EGA Administrative Assessment
    $-0.66
    SPayroll:Taxes
    EGA Unemployment Insurance
    $-3.3

    Why?

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

    Re: VB Code to transfer some data from excel to txt file

    Hello:

    Sorry that was my mistake.
    Doing in a rush....error.
    Please have a look at corrected txt file.
    Once again I am sorry for any confusion but i beleive this will hep you understand.
    Please let me know if you have any questions.
    Thanks.

    RM
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    Try
    Please Login or Register  to view this content.

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

    Re: VB Code to transfer some data from excel to txt file

    Hello:

    Seems to be correct format now.
    I will test it to import into Quicken and see if all is ok.
    Will let you know if any furtrher modification is needed.
    Thanks a lot
    RM

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

    Re: VB Code to transfer some data from excel to txt file

    Hi Jindon :

    Works great so far without any problem.
    Need to add the code to make sure that it only pull the data until the last valid row of data.
    Probably the best way is to check in column A , pull until there is D as first character.
    Please let me know if you have any questions.
    Thanks.

    Riz

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    Please Login or Register  to view this content.

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

    Re: VB Code to transfer some data from excel to txt file

    Hi Jindon:

    I get attached error when i use above code.
    Please have a look at attached 2 pics
    Please let me know if you have any questions.
    Thanks.

    Riz
    Attached Images Attached Images

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    Picture doesn't help at all.

    I need to see your file.

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

    Re: VB Code to transfer some data from excel to txt file

    Hello Jindon:

    Please refer to attached ACTUAL file.
    Here I import data file in sheet "Payroll".
    Then i have formulas in sheet "Create QIF" where it populated data from Payroll to "Create QIF".
    In "Create QIF" I run your smart created macro to generate txt/qif file.

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

    Riz
    Attached Files Attached Files

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to transfer some data from excel to txt file

    Change to
    Please Login or Register  to view this content.

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

    Re: VB Code to transfer some data from excel to txt file

    Hi Jindon:

    Thanks a lot........................
    Works
    Riz

+ 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. VBA code to transfer the excel file into another open workbook
    By blackorchids2002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2015, 01:31 PM
  2. [SOLVED] Macro code to transfer data to another file
    By RA_Lek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-04-2015, 08:09 PM
  3. how to transfer data from Excel file to Word file as per requirement
    By roofi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-25-2014, 01:39 AM
  4. Replies: 6
    Last Post: 07-16-2012, 02:12 PM
  5. Data Transfer from Excel File A to File B
    By Bruce in forum Excel General
    Replies: 0
    Last Post: 03-08-2006, 04:55 PM
  6. Replies: 2
    Last Post: 04-19-2005, 12:06 PM
  7. [SOLVED] Use ADO to transfer data from open excel file to closed excel file
    By JCanyoneer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2005, 03:06 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