+ Reply to Thread
Results 1 to 9 of 9

Export columns to text files with different headings

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    brazil
    MS-Off Ver
    Excel 2007
    Posts
    64

    Export columns to text files with different headings

    Please, I need to export some columns from a excel sheet to text files with different headings.

    This is the code that I have recorded and changed:

    Please Login or Register  to view this content.

    The way it is, all 5 columns go to the same file.
    And I have to export column A to a file whose name is in M1, column B to a file whose name is in N1 and so on, something like:

    Please Login or Register  to view this content.
    This structure is very close to what I need and to what I can adapt.

    Anyone could help me?
    Last edited by dualaudio454252; 03-17-2014 at 06:49 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export columns to text files with different headings

    Based on the way you asked the question, I guess that at some point you might want to specify other specific columns to export and other target cells for the names of each, so in the macro you will find two very basic ARRAYS, one listing the columns to target individually, the other targeting the name cells individually. This should make them very easy to edit should you ever need to:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-17-2014 at 04:58 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-19-2013
    Location
    brazil
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Export columns to text files with different headings

    Thank you, Jerry, it really works, but I got a #REF! error in each line.
    The lines cointain formulas (sorry, I didn't mentioned this).

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export columns to text files with different headings

    The macro above has been edited to account for the formulas needing to be removed. Please try again.
    Last edited by JBeaucaire; 03-17-2014 at 10:35 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Export columns to text files with different headings

    Hi..

    I am not sure if i am 100% on the requirements.. but this is how I am taking it..?

    You want to to create a text file that contains each columns values (Columns A,B,C,D,E).. and you want each text file named from the value in row 1 of Column M,N,O,P,Q..

    Is that right..?

    If so.. maybe this..

    Please Login or Register  to view this content.
    I have the text files going to a static Directory.. change that to what you want or add a Folder Browser Dialogue..
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-19-2013
    Location
    brazil
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Export columns to text files with different headings

    Thank you, Apo, but it didn't work for me.
    Thanks for your effort.

    And Jerry, sorry for the delay (I had to go to work).
    Thank you very, very, very much!!!!!!!!!!!!
    It's just like I need.
    It works perfectly!
    You´re the best!

  7. #7
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Export columns to text files with different headings

    Hi dualaudio454252,

    Out of interest.. which part of it didn't work?

    Did you try the attached Workbook..? and if so.. is the output not what you want..

    When i look at Jerrys code.. I was sure the output of my code would be the same..

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Export columns to text files with different headings

    Apo, it may be as simple as the path was missing the C:\downloads\ part.

    Also, I'd recommend you adjust the RESIZE method to resize each column separately, you've assumed all the columns of data are the same number of rows and there's no basis for that assumption.

    Lastly, we typically let the OP go once he settles on a solution, best to not pursue them specifically after the've declared it solved.

  9. #9
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Export columns to text files with different headings

    Yeap.. no worries Jerry.. good idea with having separate resizing for each column.. i missed that one..

    Lastly, we typically let the OP go once he settles on a solution, best to not pursue them specifically after the've declared it solved.
    Got it.. thanks for the advice..

+ 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. export specific cells to several text files
    By BSJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2013, 04:20 AM
  2. Excel VBA row export to multiple text files
    By warren13 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2011, 03:02 AM
  3. export columns from 3 excel files and send them to one file
    By vba_iverson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2011, 02:36 AM
  4. Export multiple columns to single column text files including special characters
    By mike4uuu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2011, 04:54 AM
  5. how to export Unicode data to multiple text files
    By world33 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2010, 12:44 AM

Tags for this Thread

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