+ Reply to Thread
Results 1 to 8 of 8

Macro Help to select the data and save as a txt file.

  1. #1
    Registered User
    Join Date
    04-29-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro Help to select the data and save as a txt file.

    Hi,

    I am new to macro's and my requirement is, i have attached my excel file, in that when i click on save data button it should copy the data from column C to X and all the rows and save a txt file on desktop. Row cell should be delimited with single blank space. Can you please help me?

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Help to select the data and save as a txt file.

    Hi,

    I use this Code that does exactly what you require, but is delimited by Commas.. See if this helps..



    Please Login or Register  to view this content.
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    04-29-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro Help to select the data and save as a txt file.

    Hi Needforexcel,

    Thank you for your response. when i am using your code i am getting runtime error '78' and when debug its highlighted "Open myFile For Output As #1". Please advice?

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Help to select the data and save as a txt file.

    Its working for me..

    See the file attached.. Press Alt+F11 and Change the path as required.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-29-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro Help to select the data and save as a txt file.

    I got it.. the issue was the path mentioned in the code which is hard coded. Is there a way that it can select automatically who ever opens the file and run this macro it should create txt file on their desktop?

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Help to select the data and save as a txt file.

    Here!

    Change the Original Line of code to

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-29-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro Help to select the data and save as a txt file.

    Thank you so much... working perfectly...

  8. #8
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Help to select the data and save as a txt file.

    Glad it helped! Please mark the thread as solved..

+ 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. [SOLVED] VBA / Macro to Select File and Save As
    By bloomingcarrot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2015, 01:13 AM
  2. Copy, edit and save workbook to same location as source data file, not macro file.
    By Jasonhouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2014, 09:01 AM
  3. Replies: 1
    Last Post: 09-05-2013, 02:39 PM
  4. [SOLVED] Macro to prompt user to select date and save file
    By TheLittlePrince in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2013, 08:34 AM
  5. [SOLVED] [Help]macro to open file browser, to select a location, and save the location to a cell
    By zhuleijia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2013, 09:56 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