+ Reply to Thread
Results 1 to 6 of 6

Exporting selected values into a new CSV file

  1. #1
    Registered User
    Join Date
    02-09-2012
    Location
    Texas, US
    MS-Off Ver
    Excel 2007
    Posts
    5

    Exporting selected values into a new CSV file

    Hi,
    I have a requirement where i need to copy selected values from a excel sheet into a new CSV file. Can anyone advice me on how to proceed? I have attached a sample excel sheet with my requirement.

    The user will be selecting D1..D6 and then B8..F9 and then clicking on the export2csv button. The result of this export is shown below in the excel sheet.

    Can anyone please advise on how to go about doing this?

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Exporting selected values into a new CSV file

    Hi,

    See attached.

    The relevant macro is

    Please Login or Register  to view this content.
    Change the 'MyFileName' text as appropriate
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-09-2012
    Location
    Texas, US
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Exporting selected values into a new CSV file

    Perfect thanks Richard.

  4. #4
    Registered User
    Join Date
    02-09-2012
    Location
    Texas, US
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Exporting selected values into a new CSV file

    The way the user works is he selects columns from D1 to D6 and then he selects rows from B8 onwards based on how many ever rows have data (this data will be in the range B8 & can go on ...). Once the selection is made he would execute the macro and the results should be in the format that i have in the Results portion of Sheet-1. Can you help refine your code to suit this requirement.

  5. #5
    Registered User
    Join Date
    02-09-2012
    Location
    Texas, US
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Exporting selected values into a new CSV file

    Hello,
    I could get part of my requirement to work but not the whole things. Instructions to execute the macro which will lead to my question
    a) When u open the sheet you will find a "Export 2 CSV" button and some data filled in.
    b) When you execute the macro you will see the values getting populated from B18 onwards (based on how many ever rows are there) to a new workbook starting from G1 onwards.

    This is working as desired.

    The macro should also do the following ...
    a) Copy the values in the column (D11 to D16) and get inserted from A1 to F1 for each row coming up in Step #b above.

    Also attaching a screen shot of what the final result set should look like
    Attached Images Attached Images
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-09-2012
    Location
    Texas, US
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Exporting selected values into a new CSV file

    I could get this to work as per my requirements. Pasting the solution for future reference
    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