+ Reply to Thread
Results 1 to 10 of 10

vba code for copy specific data to another sheet

  1. #1
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    vba code for copy specific data to another sheet

    dear all,

    since i am new with vba stuff need some help on below situation

    I have master sheet where in column a has names, All I want is filter name of each name and copy and paste the data into new workbook with the name of filtered name and with filtered names as sheet name

    like if filter with rishi then new work book with name of rishi and worksheet name rishi and in there rishi names filtered data

    pls find below is the attached dummy data

    many thanks
    Rishi Saw
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: vba code for copy specific data to another sheet

    Maybe:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 07-11-2014 at 06:51 AM.

  3. #3
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Thumbs up Re: vba code for copy specific data to another sheet

    hi

    Check attachment..

    Filter the data & double click cell A1, new file will be created in same folder.

    Cheers!!
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: vba code for copy specific data to another sheet

    no working creating loads of sheet

    i only want three sheet with name of ( for this specific attached sheet) rishi, kumar and saw

    and rishi sheet will contain only data which is name (column a ) is "rishi"

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: vba code for copy specific data to another sheet

    Hi, John,

    using SaveAs and assuming that a user who indicates 2007/2010 as used Excelversion uses *.xls as Standard File is a bit off the target for me and maybe one reason for an error (maybe refer to Ron de Bruin on SaveAs from 2007 on).

    Besides: building an array with unique names and applying the Autofilter while looping through the array could prove to be a far more elegant way.

    Ciao,
    Holger.
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: vba code for copy specific data to another sheet

    Try:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: vba code for copy specific data to another sheet

    Quote Originally Posted by HaHoBe View Post
    Hi, John,

    using SaveAs and assuming that a user who indicates 2007/2010 as used Excelversion uses *.xls as Standard File is a bit off the target for me and maybe one reason for an error (maybe refer to Ron de Bruin on SaveAs from 2007 on).

    Besides: building an array with unique names and applying the Autofilter while looping through the array could prove to be a far more elegant way.

    Ciao,
    Holger.
    Good points Holger. I definitely will refer Ron de Bruins SaveAs.

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: vba code for copy specific data to another sheet

    Hi, rishikrsaw,

    both procedures go into the same Standard Module:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    This will take the path where to save the workbooks from the workbook with the code as well as when trying to make up what extension to use for the new workbooks.

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger

  9. #9
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Re: vba code for copy specific data to another sheet

    Quote Originally Posted by rishikrsaw View Post
    no working creating loads of sheet

    i only want three sheet with name of ( for this specific attached sheet) rishi, kumar and saw

    and rishi sheet will contain only data which is name (column a ) is "rishi"
    Did you tried solution given by me?

  10. #10
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: vba code for copy specific data to another sheet

    thank you its working now

+ 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. Replies: 5
    Last Post: 12-12-2013, 02:53 PM
  2. [SOLVED] Please help, problem VBA code to copy value to another specific sheet based on cell value
    By herukuncahyono in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2013, 03:16 AM
  3. [SOLVED] copy a row to another sheet if row contain a specific code
    By skalus in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-17-2013, 11:32 AM
  4. [SOLVED] Copy and paste data from sheet 2 to sheet 1 based on specific criteria on sheet 1
    By VBADUD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 04:18 AM
  5. Replies: 0
    Last Post: 09-17-2012, 11:10 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