+ Reply to Thread
Results 1 to 9 of 9

Copying rows based on date value in an input box

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    Barnsley, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Copying rows based on date value in an input box

    I'm looking for a macro that will copy rows of data based on a date value put in an input box and the name of the salesperson.

    It is for a sales commission sheet and I am looking to copy rows of data from the previous week in one workbook and paste it to another for each salesperson/group to work out their order totals & commission for the week.

    I have attached sample workbooks.

    Any help would be appreciated

    Commision Sample.xlsm
    Sales Sample.xlsm

  2. #2
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Copying rows based on date value in an input box

    Can I clarify that data is being copied into the Commission Sample workbook?

    Also, Where does the date come into it? Is it the "Pay week" in Cell F1 Or would you like to be able to enter a date specifically into an input box as the macro runs?

    Basically I'm asking will it be a range of dates (a week) or just a specific day?
    !If all your troubles are solved, then so is the thread. Show this by marking it so using thread tools at the top of the page.
    If I helped do this, then please show your appreciation by awarding rep points.
    <------ Button for that is over there

  3. #3
    Registered User
    Join Date
    05-24-2012
    Location
    Barnsley, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copying rows based on date value in an input box

    Yes the data will be copied in to the Commission Sample workbook.

    Yes it will be a week, so a range of dates. I would like to enter the dates for the previous week in an input box if possible.

    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Copying rows based on date value in an input box

    Here you go...You shall find the code in a module in the Commission sample workbook.


    A few things to watch out for...
    1. Because you've called the workbooks ...Sample, So have I in the code so you may need to change this as appropriate
    2. Because of the limited space in the Commission workbook for records this may become a problem later..I have limited it to write into at maximum row 35.
    3. It will currently not clear the previous data.

    Have fun!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-24-2012
    Location
    Barnsley, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copying rows based on date value in an input box

    Hi that's great thank you!

    I've altered a couple of things and it works fine. Just one more thing...

    How do I get the macro to run from the Commission Sample sheet? When I do run it from there it doesn't copy over any data?

    Sorry I'm relatively new to this

  6. #6
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Copying rows based on date value in an input box

    It is already in the Commission Sample sheet and also the whole code refers to each workbook so shouldn't have a problem no matter where you run it!

    What seems to be the problem? Is there an error or does it just not do anything?

  7. #7
    Registered User
    Join Date
    05-24-2012
    Location
    Barnsley, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copying rows based on date value in an input box

    It just doesn't do anything

  8. #8
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Copying rows based on date value in an input box

    My bad... I missed the red bit..I've changed it slightly so that it reads nicer.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-24-2012
    Location
    Barnsley, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copying rows based on date value in an input box

    Thanks, that's brilliant!

+ 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. Copying rows to another sheet based on date range
    By LSAILLARD in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-14-2017, 07:43 PM
  2. Moving Rows Based on the Input of a Date
    By Building in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-17-2014, 04:42 PM
  3. [SOLVED] Date changes when copying data from an input file
    By mintymike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2014, 05:07 AM
  4. message input box returns lines/rows based on the input
    By excelandclark in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-03-2013, 07:35 PM
  5. Copying based on input
    By Gamerxx13 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-18-2013, 09:07 AM
  6. vba programing, copying based on a user input contain from one sheet to another
    By ghassabemahal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2010, 06:14 PM
  7. Copying rows based on date
    By flurry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2006, 01:10 PM

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