+ Reply to Thread
Results 1 to 13 of 13

Need a macro to move row to new sheet based on cell input

  1. #1
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Need a macro to move row to new sheet based on cell input

    I have an excel file that i have created with a cell with the IF statement. It is for contracts and I have the contract start date, length and expiration. I have excel check the expiration date with the current date using the TODAY function. If it is expired, the IF gives a "yes" in column F. I would like a macro that will move the row that contains the expired contract to the "Expired" sheet. I have gotten macros to work, but none of them automatically run for when the document is automatically opened with a macro that I wrote that opens the file, allows it to update and saves it. The cell in column F will change to "yes", but nothing will happen. To get it to work, I have to go in and manually press enter in the cell to get it to recognize that it has changed. What do I need to add to allow it to check for the "yes" automatically and updating without my input of the cell.

    Thank you

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need a macro to move row to new sheet based on cell input

    Hi R,

    Welcome to the forum!

    - can you post your code, or better yet:

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    I have attached my excel file. This is for a contracts, and I have written a program to open, allow it to update to the current date and save the file, and schedule this to run everyday with Task Scheduler. It also sends an email when a contract is near expiration (within 30 days), but right now I have it just display the email to avoid unnecessary emails. Now, I need a macro to move an expired contract from the Customers tab to the Expired tab. I have one that does that, but it only works when the cell is clicked on and entered. It does not change when the date changes which causes the IF statement to display the "yes" value in Column F which is the trigger for my macro. Test 2 and 3 are expired and have moved tabs, but not automatically so that is what I would like.I need a way so that it will automatically trigger it when the date changes so I do not have to be involved with the move. Try it out by changing the length of the contract to a length that will cause it to be expired and it will not move, but once you click on the correct cell in Column F and press enter it will move. I would like a way to make this all automated and I know I am close, but am just missing one or two lines of code.

    Thank you
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need a macro to move row to new sheet based on cell input

    Hi R,

    Try this:

    Please Login or Register  to view this content.
    Last edited by xladept; 06-08-2015 at 05:01 PM.

  5. #5
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    I added this to Customer/Sheet 1 and cannot get it to work. When it does cut and paste a row, it is the wrong row and is always the bottom two or three rows. I cannot seem to figure what the error is. Any help is appreciated. Thank you

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need a macro to move row to new sheet based on cell input

    Hi R,

    I hope you replaced the Change event with this one - if that's what you did, can you post a different sample?

  7. #7
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    Here is the code that I have inserted in my file. Nothing seems to happen when a contract expires. Thank you for working with me and being patient, I really appreciate it.
    Attached Files Attached Files

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need a macro to move row to new sheet based on cell input

    Hi R,

    It runs very nicely - perhaps you need to reset your event handler.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    I change the length to one year so that it has expired and nothing happens. I also reset my event handler. Still nothing happens

  10. #10
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    When I add change the email address in E2, it moves a bunch of my rows over to expired and I am not sure why that happens

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Need a macro to move row to new sheet based on cell input

    Hi R,

    The e-mail address is in E3 - the date is in E2??

    Try this:

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    Yes, I meant E3, that was a typo. I'll give that a try, thank you

  13. #13
    Registered User
    Join Date
    06-05-2015
    Location
    TC, MI
    MS-Off Ver
    2010
    Posts
    8

    Re: Need a macro to move row to new sheet based on cell input

    That code you have to go over cell E2 and hit enter to get it to register.

+ 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. Macro to move to Sheet/cell based on lookup
    By kingofbeans in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-19-2013, 01:18 PM
  2. Replies: 19
    Last Post: 02-08-2013, 05:59 PM
  3. Macro to move rows from one sheet to another sheet based on a cell vaule
    By d55272 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-09-2012, 03:33 PM
  4. Move Rows Based on Cell Input
    By aegliveinterns in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2010, 02:08 PM
  5. Move rows to another sheet based on column input
    By lacerz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2010, 01:02 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