+ Reply to Thread
Results 1 to 13 of 13

This is eating my brain: Find,Copy,Paste criteria is variable date.

  1. #1
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    This is eating my brain: Find,Copy,Paste criteria is variable date.

    Hi!

    First of all: Thank you for this community. It has helped me a million times in previous issues, but this one is eating my brain for nearly 3 days. Please see attached file.

    My intention is to create macro that will go through column B of the data sheet and looks for today's date (cell A1 in "Today" sheet) as the criteria. Today's date will be changeable through the "buttons" that I added already with a DateAdd function. If it finds the criteria, it should copy the rows to the "Today" sheet and paste it from row X=2 onwards. I have searched macro's for hours, tried to edit them for hours, but so far no results.

    *Even a better solution would be to create an inputbox which will be used as the criteria, in dd/mmm/yy format.

    If you require any additional information, please let me know.

    Many thanks in advance!

    Clayraw
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    Hi Clayraw,
    try it
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    Hi Nilem,

    Thanks for the quick reply and solution! However, is it possible that it doesn't clear the data from the data sheet but just copy it? How should I add a loop so that it searches the data sheet till the last entry of the specified date? Is it possible to specify the columns that have to be copied instead of copying the whole row?

    Thanks again!
    Last edited by Clayraw; 12-09-2013 at 04:03 AM.

  4. #4
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    *edit. Sorry. I saw it worked already. However, could you tell me how to change the cell range? this time the dates are in the Data sheet, column C. the data is starting from A2 in the same sheet. the data should be pasted from cell A3 onwards in the "Today" sheet.

    Thanks

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    try
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    It didn't work out as planned somehow. I started editing your code and tried to make the criteria1 based on cell value x1 (variable date). What happens now is that it doesn't filter correctly but just pastes all data in my "Today" sheet and deletes it directly as well. So I end up with nothing at all. Could someone have a look at the things I did wrong?

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    Hi,

    Attached is my solution and i have modified it to suit your requirements.

    Firstly , click on the Select file to select your actual data source and then enter the date for which you want to extract the data in the cell ("G2") and then click on process.

    Hope this helps.
    Attached Files Attached Files
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    Clayraw, could you show an example of your file with the actual location of the data

  9. #9
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    Please see attached.

    Many thanks
    Attached Files Attached Files

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    it is not clear what data (of which columns) you want to copy to the sheet "Today"

  11. #11
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    the data sheet is on sheet "Data", column A till O with range A2:O10000 since the data entries depend on no. of sellings per period of time

    I would like to autofilter that range with cell X1 on the "data" sheet as the criteria and then copy the entire columns to the "today" sheet, pasting from cell A2 onwards.

  12. #12
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    try
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-09-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: This is eating my brain: Find,Copy,Paste criteria is variable date.

    Unfortunately it is only copying the column headers, but not grabbing the data below. It seems like the auto filter is not filtering, since I checked if I have any entries for multiple dates. I tried the alternatives as well (which were comments first) but it had the same issue.

    The formatting of the date cells are the same as mentioned in the macro:

    .AutoFilter Field:=3, Criteria1:=Format(.Range("X1"), "d/mmm/yy")

    Any other ideas? In the meantime I will be trying some things as well.

+ 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] Find the date and copy the values from the colum of the date find and paste to other sheet
    By nizzcmzph in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-20-2013, 10:03 AM
  2. [SOLVED] Copy and paste to new spreadsheet based in date and other criteria are met VBA
    By andie2013 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-15-2012, 01:29 PM
  3. [SOLVED] Macro to Find, copy, paste, find, copy, paste, find, copy, paste, u get the picture....
    By westsoldman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2012, 01:12 AM
  4. Copy Rows That Match Variable Criteria And Paste To A New Worksheet
    By BrodyNoochie in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-19-2012, 04:20 PM
  5. Find, Copy, Paste variable rows to another sheet
    By wkhor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2011, 07:37 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