+ Reply to Thread
Results 1 to 16 of 16

Trying to copy/paste rows matching a date value

  1. #1
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Trying to copy/paste rows matching a date value

    Hi all,

    I have a sheet ("Uplifts") with daily entries.

    CallDate UpliftNumber CallNumber CPC Size Category Reason
    17-Aug-15 51002247 4645778 5P1204 Pallet Picking Error Operator Error
    18-Aug-15 51002293 4674543 5P1300 Case Picking Error Operator Error

    I am trying to pick out any entries with today's date in column A and paste them into another sheet ("Temp"). I can't work out where this code is wrong, as it picks up the source sheet headers in Row 1 and pastes that, but not the corresponding entry from Row 3 which matches today's date. So my resulting code pastes just this in ("Temp"):

    CallDate UpliftNumber CallNumber CPC Size Category Reason

    Here's the code:

    Please Login or Register  to view this content.
    Any help or direction appreciated!

    Pete
    Pete
    Struggling Solutions Architect

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Trying to copy/paste rows matching a date value

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    Hi John

    Error 1004 - Select method or Range class failed
    is all I got, after it pasted in the first 4 columns only of the header row, almost the same but less columns as my previous code!!

    Pete

  4. #4
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    can anyone else assist please? No disrespect to John who answered above, it's just that I need to get this fixed

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Trying to copy/paste rows matching a date value

    Can you attach a sample file which produces the error?

  6. #6
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    sure can John, here goes
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    but of course, the dates in the 'Uplifts' sheet don't now correspond to today, so you may want to play with the dates in the worksheet first

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Trying to copy/paste rows matching a date value

    Try:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    Hi John,

    That did the trick!
    Thanks for your help
    Pete

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Trying to copy/paste rows matching a date value

    You're welcome Pete. Glad to help out and thanks for the feedback.

  11. #11
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    Hey John,

    Sorry to re-open this thread, but I now have a need to change the code to incorporate a StartDate and End date - is this possible?
    Here's the code as is:

    Please Login or Register  to view this content.
    The new parameters would be Me.StartDate and Me.EndDate
    Really appreciate your help mate, if I was closer I'd shout you a beer!

    Pete

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Trying to copy/paste rows matching a date value

    Not sure I understand. What exactly do you want to happen with the Start Date and End Date?

  13. #13
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    Sorry John, perhaps I was lax with my explanation.

    The code your provided before identified rows matching today's date. It works perfectly.
    What I need to do now is select a more expansive range of rows where the Date falls between between the StartDate and EndDate parameters.
    It's for a weekly/monthly report scenario, and will work on historical rows that occur >=StartDate and <=EndDate.

    Late Edit: This will work off another form, for reporting purposes only

    Does that make more sense?

    cheers
    Pete

  14. #14
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    in direct terms, copy all rows with value of Column A between StartDate and EndDate and paste them to the Temp sheet, as the previous code does where value of Column A is today

    Pete

  15. #15
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Trying to copy/paste rows matching a date value

    Maybe:

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Trying to copy/paste rows matching a date value

    Hi John,

    Works perfectly mate, many thanks and another beer on your tab!

    Pete

+ 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. Copy paste values to a cell with matching date
    By Beggar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2014, 12:49 AM
  2. Replies: 1
    Last Post: 09-03-2014, 12:46 AM
  3. Macro to copy rows based on moving date and paste the rows into an identical sheet
    By ivandc1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2014, 11:59 AM
  4. [SOLVED] Userform for date entry and then copy/paste matching data to another sheet
    By nymanns in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2013, 03:22 AM
  5. [SOLVED] macro to copy and paste only the rows containing a date in column A
    By s_vinti in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2012, 01:58 PM
  6. [SOLVED] Copy if date / paste below matching value in another worksheet
    By Lacaycer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-20-2012, 02:56 PM
  7. code required to copy and paste rows matching a criteria.
    By Duguid1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-30-2008, 04:49 AM

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