+ Reply to Thread
Results 1 to 24 of 24

VBA to copy data into other sheets based on specific criteria’s

  1. #1
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    VBA to copy data into other sheets based on specific criteria’s

    Hello,
    I need your help in preparing a Dash Board. I have an excel file with data pulled from external source & have lot of dump in it. I am looking for specific data that need to be pulled from that dump and saved in another sheet of the same file (as in example file).

    In the Received Sheet:
    1. It should prompt for the date and after entering the date (21- Jan in example file) it should fetch the data of Team A to Team E and paste it in Received Sheet based on Column L (Insert_time).
    2. If this sheet is not available it should create a new one, if the sheet is already available then it need to clear the old data and paste the new one.

    In the Closed Sheet:
    1. It should prompt for the date and after entering the date (21- Jan in example file) it should fetch the data of Team A to Team E and paste it in Closed Sheet based on Column N (Close_Time) & Column U (Status of only “Closed”, “Closure Pending”, “Verified Closed”)
    2. If this sheet is not available it should create a new one, if the sheet is already available then it need to clear the old data and paste the new one.

    In Open Sheet:
    1. It should fetch the data of Team A to Team E based on Column U (Status of only “Open”, “New”, “pending”)

    I have attached the sample spread sheet for your reference. Sorry if my request is not clear.

    Thanks in advance for your help!!

    Regards,
    Humac
    Last edited by humacdeep; 01-31-2012 at 08:29 AM. Reason: Solved

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    Your sample data shows Teams F, G & X along with Teams A to E. What should be done for these 3 teams?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Hi Arlette,

    Thanks for your response. It should ignore all other teams apart from Team A to Team E. I may even have more teams in the orginal data but looking for only specific teams data in the result.

    Regards,
    Humac

  4. #4
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Hi Arlette,

    Did you get a chance to look into this?

    Regards,
    Humac

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    Sorry, i have another question - in your first post, you have mentioned that the code needs to prompt for the date twice, will the dates in both prompts be the same? Can the prompt be given only once in that case?

  6. #6
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Yes, the date is same for both prompts & can the prompt can be given once.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    While working on the code for your request, i landed upon another doubt - will the sheets Received, Closed and Open be blank when the data will be copied over? So i can just search for the date provided and then copy the contents over from sheet1 to the required sheet?

  8. #8
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    No, I will use the same template daily. So the code need to clear the existing data in Received, Closed and Open sheets & then copy the data.

    Also all the Received, Closed and Open sheets should have the Heading from Row1 of the Sheet1.

  9. #9
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Hello Arlette,

    Any luck on this?

    Regards,
    Humac

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    Humac, last nite the forum was down for some time during the upgrade to the new server. I will try something now and post it.

  11. #11
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    No Prob... Thanks!!

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    Use this code - it takes care of all 3 requirements -
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Thanks Arlette, I will test and let you know the result.

  14. #14
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Hello Arlette,

    I have tested the code in Orgianl data, it is creating all the required sheets but once I enter the date it is not copying data in Received & Closed Sheets. I have attached the sample sheet. please have a check.

    I have entered 25-Jan as Date.

    Regards,
    Humac
    Last edited by humacdeep; 01-31-2012 at 08:32 AM.

  15. #15
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Its working as desired in DashBoard.Xls (sample data) & not in DashBoard_1.xls (Orginal Data), the only difference is between two files is Table format. Does this code will not work if the data in Sheet1 is in Table format?

  16. #16
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    In Dashboard_1, you have marked the code for Closed and Open in green (commented it). This will prevent the code from running. Any specific reason why you have done so?

  17. #17
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Hello Arlette,

    I commented that to see what all are executing in 3 sheets, only Open sheet is populating the data. Even if I execute the entire program its only populating data in Open sheet.

    Regards,
    Humac

  18. #18
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    The date format that you gave me in the dummy file was dd-mmm but in this file, its with a timestamp as well. So i just had to change a few things and got it working. Use this code -
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Thanks a LOT & I appriciate your help!! Its working gr8.

    I got the point now, it populated data in Open sheet because it does not need date to validate the data .

  20. #20
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA to copy data into other sheets based on specific criteria’s

    Yes exactly. Next time ensure that you give the data in the same format as your original file, it works faster.

  21. #21
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Sorry about that. Actually I have added the same way in the sample sheet, but due to my excel format it has been changed to dd-mmm . I make sure to double check it from now onwards.

  22. #22
    Registered User
    Join Date
    01-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: VBA to copy data into other sheets based on specific criteria’s

    hi all,

    i also have some problems when i want to copy data from other files.

    I want to use Command button to open folder, which contains .csv files. When i'll choose one of the files the aplication should put all the data from the file to an excel sheet 1.

    could you pls help me with this?

  23. #23
    Forum Contributor
    Join Date
    09-10-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    176

    Re: VBA to copy data into other sheets based on specific criteria’s

    Karo,

    Welcome to Forum!!!

    As per the forum rules No. 2 you should not hijack others thread. Please submit a new thread and some one will get back to you.

    Forum Rule 2: Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread.


    Regards,
    Humac

  24. #24
    Registered User
    Join Date
    01-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: VBA to copy data into other sheets based on specific criteria’s

    sorry, i'm new here, it wont happen again

    karo

+ 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