+ Reply to Thread
Results 1 to 7 of 7

Export excel sheet data in to text file by iterating data with other sheet

  1. #1
    Registered User
    Join Date
    06-02-2018
    Location
    IND
    MS-Off Ver
    2010
    Posts
    18

    Export excel sheet data in to text file by iterating data with other sheet

    Hi,

    i am new to development, i have googled my requirement but i did not get what i am looking for.Below is my requirement..

    i have to sheets(sheet1 and sheet2) in excel file.
    Sheet1 has data of server name, starttime and endtime
    sheet2 has user and his name.
    i want to provide access to each user to the servers mentioned sheet1 in below format. and export that to text file

    server1:user1:hisname:starttime:endtime
    server2:user1:hisname:starttime:endtime...


    Any guidance or help much appreciated
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    5,124

    Arrow Re: Export excel sheet data in to text file by iterating data with other sheet


    Hi,

    attach the expected text file result

  3. #3
    Registered User
    Join Date
    06-02-2018
    Location
    IND
    MS-Off Ver
    2010
    Posts
    18

    Re: Export excel sheet data in to text file by iterating data with other sheet

    Hi Marc,

    thanks for your response, my expected output text file is like below.

    server1:user1:name1:040220201030:040220202230
    server2:user1:name1:040220201030:040220202230
    server3:user1:name1:040220201030:040220202230


    server1:user2:name2:040220201030:040220202230
    server2:user2:name2:040220201030:040220202230
    server3:user2:name2:040220201030:040220202230

    .... for each user to all the list of servers

  4. #4
    Registered User
    Join Date
    02-23-2020
    Location
    France
    MS-Off Ver
    2019
    Posts
    44

    Re: Export excel sheet data in to text file by iterating data with other sheet

    Here comes a solution.
    I renamed the sheets with explicit names.
    The output file name is Auth.txt in same directory as the .xlsm file
    The date format must be adjusted, since it contains colons that might be understood as field separators.
    To run the macro, hit Ctrl+r

    HTH,
    --
    AP

    PS: i read the OP more closely and noticed the correct date format. A new version comes soon.
    Attached Files Attached Files
    Last edited by ArdusPetus; 04-04-2020 at 07:40 AM.

  5. #5
    Registered User
    Join Date
    02-23-2020
    Location
    France
    MS-Off Ver
    2019
    Posts
    44

    Re: Export excel sheet data in to text file by iterating data with other sheet

    Here comes the new version with correctly formatted dates.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-02-2018
    Location
    IND
    MS-Off Ver
    2010
    Posts
    18

    Re: Export excel sheet data in to text file by iterating data with other sheet

    thanks a lot ArdusPetus, this is what i am looking for.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    5,124

    Cool Another way


    A VBA beginner starter according to the initial post so according to the original attachment as it is :

    PHP Code: 
    Sub Demo1()
      Const 
    ":""mmddyyyyhhmm"
        
    Dim N%, VL&, R&, S$
            
    FreeFile
            V 
    Sheet1.UsedRange.Value2
            
    For 2 To UBound(V):  V(L2) = Format(V(L3), F) & Format(V(L4), F):  Next
            Open ThisWorkbook
    .Path Application.PathSeparator "Export .txt" For Output As #N
        
    With Sheet2.UsedRange.Rows
            
    For 2 To .Count
                S 
    Join(Application.Index(.Item(R).Value210), D)
            For 
    2 To UBound(V)
                Print 
    #N, V(L, 1); S; V(L, 2)
            
    Next LR
        End With
            Close 
    #N
    End Sub 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon Add Reputation !

+ 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. Replies: 1
    Last Post: 05-10-2019, 05:05 AM
  2. Move data from Listbox to another then export data in excel sheet
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2019, 03:36 PM
  3. Macro that will export a sheet to a .dat text file (Excel 2003)
    By CameronR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2013, 08:47 AM
  4. Replies: 3
    Last Post: 09-04-2013, 02:30 PM
  5. Excel data (sheet data + charts) export to ppt presentation
    By pntuehut99 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2012, 05:55 AM
  6. [SOLVED] Export data to txt file/new sheet (selected header)
    By liangcaihong in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2012, 04:02 AM
  7. copying data from text file to excel sheet
    By sreedhar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2005, 09:05 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