+ Reply to Thread
Results 1 to 19 of 19

Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

  1. #1
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Hi Experts,

    I have tried creating my own commandbutton on sheet 2, so I can click for it to populate all data from sheet 1 with the date from today's date going back 6 days to give a accurate account of work carried out last week.

    I have failed miserably. Could really do with some help. Can you help me with the source code to type into the commandbutton source, Commandbutton1 is the name of it and the table attached as a image for you to view without risk.

    Any help would be much appreciated.

    Thanks,

    Jett
    Attached Files Attached Files
    Last edited by paintballjett; 07-08-2017 at 05:47 PM.

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Hi paintballjett, welcome to the forum. To clarify, you wish to copy entire rows for the last 7 days from Sheet1 to Sheet2?

    ps. A small sample workbook (NOT a picture) would really help us to solve your problem quickly and accurately.
    Remove any sensitive or extraneous info, just show us what cells contain your data and simulate some results so we can see what you want.

    To attach a workbook:
    Click Edit Post (or just start a new reply.)
    Click Go Advanced
    Scroll down to Manage Attachments and click.
    Now just Browse for your file, then click Upload. Simple!
    Last edited by leelnich; 07-08-2017 at 05:32 PM.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .

    Paste in Routine Module:


    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Thanks for your advice. There is no sensitive information on this document, I opted for the photo as I have seen some programmers not agree with downloading the spreadsheet.

    Anyways, I have done as requested.

    Jett

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Final version available in post #19
    Or this, if you want to move data to Sheet2. Paste this macro in a standard module and assign it to your button:
    Please Login or Register  to view this content.
    ps. You should look into Filtering (on the Data ribbon) to hide rows temporarily, using whatever criteria you set. It's very useful.

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-09-2017 at 02:51 PM.

  6. #6
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Quote Originally Posted by Logit View Post
    .

    Paste in Routine Module:


    Please Login or Register  to view this content.
    Wow, thankyou so much for your help. It came up with an error saying subscript out of range. Did i do something wrong?

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .
    Are your sheets named Sheet1 and Sheet2 ... that is the most likely error area.

    Please Login or Register  to view this content.


    Please Login or Register  to view this content.


    Sheet1 is where the data is being reviewed / copied from.

    Sheet2 is where the data is being pasted to.

  8. #8
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Final version available in post #19
    This code is tailored to your workbook, using sheet names "All Jobs" and "Jobs 7 Days":
    Please Login or Register  to view this content.
    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-09-2017 at 02:53 PM. Reason: Updated to turn off filtering

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .
    The corrections would be :

    Please Login or Register  to view this content.


    Please Login or Register  to view this content.

    The complete macro:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Quote Originally Posted by Logit View Post
    .
    The corrections would be :

    Please Login or Register  to view this content.


    Please Login or Register  to view this content.

    The complete macro:

    Please Login or Register  to view this content.
    Any idea why it changes the date value to a number when converting it to sheet 2 or (Jobs 7 Days) it goes from a date format to 429212, 429213 etc?

    Also it doesn't filter out any entries over 7 days old. Tried adding an IF statement but that didnt work for me.

    Cant thankyou enough for all your help.

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .
    On sheet "Jobs 7 Days" you need to highlight the Col A - Right Click - Format Cells - Date - Type - 3/14/2001 .


    It doesn't filter out any dates older than 7 because you specified "equal to or less than one week" .


    This line in the macro controls which dates it will filter :

    Please Login or Register  to view this content.

    More specifically, you can edit this portion to change the date range :

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Quote Originally Posted by Logit View Post
    .
    On sheet "Jobs 7 Days" you need to highlight the Col A - Right Click - Format Cells - Date - Type - 3/14/2001 .


    It doesn't filter out any dates older than 7 because you specified "equal to or less than one week" .


    This line in the macro controls which dates it will filter :

    Please Login or Register  to view this content.

    More specifically, you can edit this portion to change the date range :

    Please Login or Register  to view this content.
    Thankyou again, formatted cells. I have read the If statement and i believe it should hide any that are older than 7 days. So why is it not doing that when I run the macro? From my understanding of reading your code it should hide anything over 8 days old but I have every bit of data copied instead.

  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .
    I've been reviewing your data in the cells. The dates as written in some of the cells were combined with Cols B, C & D data as well.
    Some of the Dates in Col A were only combined with a few other columns.

    I've gone through all of the entries in Col A and made edits where required so only a DATE shows in Col A - Only a location shows in Col B - and only the complaint shows in Col C.
    In the future make certain the data is entered separately into each column as designed.

    Also, continue to use the same date format for entry of dates : 3/14/2001 . You can format Col A on both sheets so the date displays in that manner.

    See the attached ... it should work as desired.
    Attached Files Attached Files

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .
    It's fairly late in London. Can't sleep ?

  15. #15
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Quote Originally Posted by Logit View Post
    .
    It's fairly late in London. Can't sleep ?
    Putting your insomnia too good use, Thankyou so much for your help. It is now working but not only that I have learned a lot and the errors in my ways.

  16. #16
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Quote Originally Posted by Logit View Post
    .
    I've been reviewing your data in the cells. The dates as written in some of the cells were combined with Cols B, C & D data as well.
    Some of the Dates in Col A were only combined with a few other columns.

    I've gone through all of the entries in Col A and made edits where required so only a DATE shows in Col A - Only a location shows in Col B - and only the complaint shows in Col C.
    In the future make certain the data is entered separately into each column as designed.

    Also, continue to use the same date format for entry of dates : 3/14/2001 . You can format Col A on both sheets so the date displays in that manner.

    See the attached ... it should work as desired.
    I noticed this when editing it too, I did change it in the copy I was playing with, the joys of having multiple people enter data.

  17. #17
    Registered User
    Join Date
    07-08-2017
    Location
    London
    MS-Off Ver
    2010
    Posts
    10

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    I am going to have a go at making the button delete current data on sheet 2 (Jobs 7 Days) first then populate the data. Wish me luck.

  18. #18
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    .
    Great. Glad it works as you needed. Cheers !

  19. #19
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Help extracting all data from sheet 1 carried out within the last 7 days to sheet 2.

    Hi all- I also noticed (and corrected) the odd entries. Please take a look at the attached workbook. Code is already attached to your command button. Enjoy... (
    Please Login or Register  to view this content.
    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Attached Files Attached Files
    Last edited by leelnich; 07-09-2017 at 12:16 AM.

+ 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. Dates, Days and Extracting from Attendance Sheet
    By wedzmer in forum Excel General
    Replies: 15
    Last Post: 03-22-2015, 10:20 PM
  2. Replies: 0
    Last Post: 08-03-2014, 03:32 AM
  3. Extracting Sum in one sheet with daily data being refreshed in another sheet.
    By Paritosh negi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-03-2013, 07:47 AM
  4. Replies: 5
    Last Post: 07-10-2013, 02:33 PM
  5. Extracting data from a row on one sheet into another sheet based on a unique cell
    By roshanvarghese in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-23-2013, 03:49 AM
  6. Incomplete rows carried over into new sheet?
    By EddScott in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-13-2011, 05:46 AM
  7. sorting and adding data to be carried over to seperate sheet
    By digital1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2009, 06:33 PM

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