+ Reply to Thread
Results 1 to 6 of 6

Export specific range to text file and import the text file if needed

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Export specific range to text file and import the text file if needed

    Hello everyone
    I need a macro that enables me to specify sheet and range to be exported to text file ..
    for eample : Sheets("Data").Range("A5:B10")
    of course clear all the data or kill the text file before exporting (The text file to be in the same path)

    Also I need another macro that enables me to import the data exported and at this point to have inputbox that enables me to specify that range or the cell to which the imported data will be put

    I hope it is clear
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Export specific range to text file and import the text file if needed

    Hi,

    Please Login or Register  to view this content.
    To select range from differet sheet (not the activesheet), when the inputbox show up, click the target sheet tab first, and then select the range, or you can directly type the full path range to the input box.


    Regards

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Export specific range to text file and import the text file if needed

    Thank you very much Mr. Karedog for this wonderful code
    It works like charm ..
    I need to make the output file name embedded in the code as I was obliged to type the file name followed by the extension

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Export specific range to text file and import the text file if needed

    You are welcome.

    If you have predefined output filename, then change this line :
    Please Login or Register  to view this content.
    to something like :
    Please Login or Register  to view this content.

    Regards

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Export specific range to text file and import the text file if needed

    Sorry Mr. Karedog for not reading the code before posting post 3
    i had to do it myself .. but I prefer with you to just be learner .. You're professional and your lines of code are wonderful .. i really like all your solutions

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Export specific range to text file and import the text file if needed

    It's alright. Maybe because we have the same interest, that is, to avoid as much as possible using the GUI Excel objects, and prefer using non GUI solutions (array, collection/dictionary, etc) instead.


    Regards

+ 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. Macro to export specific range of data to text file for each worksheet
    By sonofamonkey10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 05:43 PM
  2. [SOLVED] Help Really needed. Export excel to text file.
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-07-2013, 12:30 PM
  3. Replies: 0
    Last Post: 10-29-2008, 06:21 PM
  4. [SOLVED] How do I import text file, analyze data, export results, open next file
    By Geoffro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2005, 04:06 PM
  5. Export / Import to / from Text file
    By C_Ascheman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-22-2005, 08:06 PM

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