+ Reply to Thread
Results 1 to 9 of 9

Copy by criteria in two worksheets into the 1st work sheet

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Unhappy Copy by criteria in two worksheets into the 1st work sheet

    Hi All,

    Good Morning! I needed help on creating a macro that copies all names from Cell B in the MainPage worksheet and Senior Worksheet
    into the Mainpage worksheet Cell (P) given that the late considered (Cell J) is equal to "Y".

    At the same time it also copies the data to DB sheet. Please review and advise. Thanks

    copy critieria.xlsx
    Last edited by city; 06-22-2012 at 02:27 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy by criteria in two worksheets into the 1st work sheet

    city,

    Give this a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Copy by criteria in two worksheets into the 1st work sheet

    Thanks for the quick response. The code works. The only problem Im currently getting is for the MainPage Sheet.
    it should only copy the values with Y in the MainPage worksheet only into Cell (P) of MainPage

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy by criteria in two worksheets into the 1st work sheet

    Oh, I see, you don't need the items from the 'Senior' sheet listed on the 'MainPage' sheet.
    Updated code:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Copy by criteria in two worksheets into the 1st work sheet

    Thanks for helping me out tigeravatar. Im really having problems with this part of the code

    Please Login or Register  to view this content.
    What if I want it to be in the middle of the spreadsheet?
    for example I have another table before the tardiness table and I need to copy those data in that table. .

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy by criteria in two worksheets into the 1st work sheet

    city,

    I'm not sure what you just said. If you don't want to use Rows.Count, replace that with the row number to start at. For example
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Copy by criteria in two worksheets into the 1st work sheet

    It always copies the data in the last cell that has a value. im trying to learn the code. Thanks for the prompt responses. Really appreciate it.


    I added another table under the agents tardy table. When I run the macro it copies the values (agents tardy) in the absents table.



    See attached file.

    copy critieria.xlsm

  8. #8
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy by criteria in two worksheets into the 1st work sheet

    city, I wouldn't recommend having a table underneath another table. I would instead recommend they be adjacent to each other, or on separate worksheets. Then you can change the destination column, or the destination worksheet which is much easier and adaptable than adjusting the code to put items in the tables that are on top of each other. It also doesn't limit the amount of rows the top table can hold, because there won't be a table beneath it.

  9. #9
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Copy by criteria in two worksheets into the 1st work sheet

    Just curious. I actually wanted to apply the code to a different type of report. Anyway. Thanks for the help tigeravatar. This code really helped me.

+ 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