+ Reply to Thread
Results 1 to 11 of 11

format sheet info then export to text file

  1. #1
    Registered User
    Join Date
    09-25-2012
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    35

    format sheet info then export to text file

    Is it possible to search a column for matching titles then extract the data from the other column cells
    I have attached a excel file and hopefully final text file format where I have a group of titles each row would be a specific airdate and time for that title.
    The title has multiple date and times but I want to combine them into one text file.
    Sheet 1 is the list of titles and airdates
    Sheet 2 is the final look then this would be exported to a text file
    Sheet 3 is extra information to add to the final text file also.
    I have captured a macro of the process but it is specific to one title and cells.
    Thanks
    Dale
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: format sheet info then export to text file

    dalerdd,

    Give this a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    09-25-2012
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: format sheet info then export to text file

    That works great! Thanks
    If I wanted to change the name of the text file to match cell A1 - C1 so the text file would be something like this Wild Girl~CLP
    Also is there anyway for it not to change the name of the excel file, from the original name?
    would the change happen in this part of the code?
    Please Login or Register  to view this content.
    Last edited by dalerdd; 10-12-2012 at 01:20 PM.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: format sheet info then export to text file

    For changing the text file name:
    Please Login or Register  to view this content.
    As for not changing the name of the excel file, it doesn't technically change the name of the excel file. You can verify this by going to where the excel file is saved and it should still be there with the original name. However, the opened excel window will update to whatever was last saved, which is why the name appears to be changing.

  5. #5
    Registered User
    Join Date
    09-25-2012
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: format sheet info then export to text file

    Thanks tigeravatar that works great.
    Dale

  6. #6
    Registered User
    Join Date
    09-25-2012
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: format sheet info then export to text file

    My incoming data has been altered slightly I was trying to edit the code to adapt but was not sure if I needed to duplicate ranges or not.
    First, I need to use column A as my file name while column B is the first line of the text file and also the title to use for comparison.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    The text file name would be from Column A, while first line of text file A1 would be Column B.

    Then the next part is to change up where second line information and shifting the dates to look at column H - J

    Please Login or Register  to view this content.
    This seems to work but as soon as I add
    Please Login or Register  to view this content.
    Putting range C to G into A2 line of the text file it puts it in but adds stuff to A3?

    Attached revised Excel

    Thanks
    Dale
    Attached Files Attached Files

  7. #7
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: format sheet info then export to text file

    Using your revised workbook, can you provide one of the text files showing the expected output?

  8. #8
    Registered User
    Join Date
    09-25-2012
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: format sheet info then export to text file

    The layout is not much different the reason for looking at a different column, the system wants to see a name like this "Chase, The.txt" while really it should display like "The Chase". This is only when there is a "The" or "A" at the beginning of the name.
    The second line would be customizable via the excel, then I have a button calling up your script to export the text files. The column H - J would come from another excel file.
    I am then reading the text file into another program and spliting up the string using the "~" or "^" characters.

    Thanks
    Dale


    My Girl~CLP
    0;00~6;00^10/7/2012~0~19:00
    10/7/2012~0~12:00
    10/7/2012~0~19:00
    Attached Files Attached Files

  9. #9
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: format sheet info then export to text file

    So in your sample text file, you only use the very last row of column C:G information (row 11 in this case). Will that always be the case? For instance, using Wild Girl, should it only use the last found row of Wild Girl (row 7) for the column C:G information and ignore the other rows of C:G info?

    I also see that the information from Sheet3 is now missing completely. Do you no longer need to look at Sheet3 A1?

  10. #10
    Registered User
    Join Date
    09-25-2012
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: format sheet info then export to text file

    No, the program could have multiple airdates and times, and only the prime time version would be put in the second row.
    example time ranges from 18:00 - 23:00 then if there are two it would be the version closest to the 21:00 hour.
    Since this is different for each title I thought it would be easier for the person to enter the data in then hit the export to text button which calls your script.

  11. #11
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: format sheet info then export to text file

    Alright, I think this should do what you're looking for:
    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)

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