+ Reply to Thread
Results 1 to 14 of 14

Need Code to copy Data to other sheets on condition

  1. #1
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Unhappy Need Code to copy Data to other sheets on condition

    Hello Guys,

    I need to copy the data to other sheets on conditions
    Below is example...

    Source Data

    Sheet1

    CAT: 001
    Percent
    NA
    NA
    NA

    DOG: 002
    Percent
    NA
    15%
    NA

    Lion: 003
    Percent
    NA
    NA
    NA

    Snake: 004
    Percent
    NA
    NA
    8.01%

    Excel Sheet1 contains above data..
    I am asked to Write macro to solve the Below purpose

    1)Search "Percent" Column for values.. and return with its Animal Name & number on Sheet2..
    Output would be -

    DOG: 002
    SNAKE: 004

    As DOG: 003 & SNAKE: 004 have %value in it.


    2) Split the Data on the basis of animal..
    Sheet1 will have Cat: 001 Data
    Sheet2 will have DOG: 002 Data
    Sheet3 will have LION: 003 Data
    Sheet4 will have SNAKE: 004 Data
    and so
    Note there might be n number of animal names in the sheet1


    Please help
    Last edited by Parth007; 12-26-2014 at 10:08 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Need Code to copy Data to other sheets on condition

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Need Code to copy Data to other sheets on condition

    Input sheet contains input data

    Now on the data of input sheet below should be the output

    Summary Sheet - Should contain data who have % value in it
    Sheet 3, Sheet 4, Sheet 5, Sheet 6 - Contains biffurcated specific animal data.


    Sheet attached
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Need Code to copy Data to other sheets on condition

    This will get you started,
    It loops through the range.areas and copies and pastes them to a new sheet.



    Please Login or Register  to view this content.
    Maybe somebody else can work on the other part.
    Last edited by davesexcel; 12-26-2014 at 11:28 AM.

  5. #5
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Need Code to copy Data to other sheets on condition

    Thanks DAve.. i tried this code but its not working in my case...

    Plz help

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Need Code to copy Data to other sheets on condition

    See the attached. Few lines added in Dave's code to take care of your Summary Sheet's requirement. Click the yellow button on Input Sheet to get the desired output on Summary Sheet and to add new sheets to have similar data as per Dave's code.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  7. #7
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Need Code to copy Data to other sheets on condition

    Hi Sktneer, thanks it met the requirenment..
    But one more thing which i came to know that the cell values would be changed..
    Please find attached File which have a updated data...

    The animals names is in Cloumn B
    And the % data is in Column A
    Attached Files Attached Files

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Exclamation Re: Need Code to copy Data to other sheets on condition

    Parth! you should be very clear about the sheet layout before asking a question specially when you are requesting for a VBA code. You completely showed the data in a different way in your first sample workbook. Please take care of this in your future threads if any.

    Anyways find the attached to see if this is what you are trying to achieve.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Need Code to copy Data to other sheets on condition

    I apolozise for it.. But the code you have provided.. makes my project complete thanks a Lot

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Thumbs up Re: Need Code to copy Data to other sheets on condition

    You're welcome Parth.
    Please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

  11. #11
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Need Code to copy Data to other sheets on condition

    Hi sktneer,

    I am done with the automation... Today i received one last new task..

    ONe client needs summary page to get filled as per the INput sheet data.. data is little bit different..
    i have attached the sample file..

    Please help me here.. i am trying to build code accordingly but i am not able to
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Need Code to copy Data to other sheets on condition

    Thanks all.. i made the automation complete... thanks for all help i got here

  13. #13
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Need Code to copy Data to other sheets on condition

    Good to know that Parth.
    BTW you may also try this. See the attached sheet.
    Attached Files Attached Files

  14. #14
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Red face Re: Need Code to copy Data to other sheets on condition

    Hi sktneer,

    Thanks this to worked

+ 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] Alter Code for Copy and Paste of Data to Created New Sheets.
    By Ortz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2014, 10:32 PM
  2. [SOLVED] Copy data in different Sheets - vba code
    By missy22 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-05-2012, 12:57 PM
  3. VBA Code to open a file and copy data to 2 sheets
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2012, 08:47 AM
  4. Code Required To Use Condition To Copy Data From Different Worksheets Into Another Sheet
    By lukerogers1987 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-29-2012, 05:26 AM
  5. need help with code to copy data from multiple sheets to one sheet
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2012, 01:07 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