+ Reply to Thread
Results 1 to 9 of 9

how to create a worksheet OPEN event to scan a sheet based on dates (expired)

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    this is a continuation of this POST:

    so what i am looking for is the following:

    Use the worksheet open event to scan the sheet "Closed POs" and look for expired dates (anything more than a month) in column D.

    i already have the code for the change event and that works. what is needed now is the above.

    can anyone help me out with this?

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    Hi again.

    I would recommend that you use a separate routine to process the cells like this
    Please Login or Register  to view this content.
    then call that as required
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    @xlnitwit,

    your sub is named ProcessDates but the following two macros used ProcessCells. should i change ProcessCells to ProcessDates?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    Yes, sorry. It was typed freehand here so I confused myself!

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    so i got the stub to work, thanks for that.

    now i have to create the macro that moves the data from the workbook "Status of POs" on the "Closed POs" sheet to the "ClosedPOsOverAMonth" workbook on the "ClosedPOs" sheet. in fact there will only be one sheet in this workbook so best to refer to this as Sheets(1) i think.

    the first thing is to see if the "ClosedPOsOverAMonth.xlsm" is Open, if it's not then open it (my code dies at this part), note that i removed the if statement to get the worksheet to open but it still fails.

    then when the date changes in col D on the "Closed POs" sheet, it moves the row (A:D) to the next available row in "ClosedPOsOverAMonth". there is only one table on this sheet.

    so here is the code that is failing:

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    im stuck on the wb and ws statements. it errors on the set tbl=ws.listobjects(1) line.

    any ideas on how to fix this error?

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    so i had to start over from the stub. i got this working (sortof), my question is how to move the target.row and add that to the table on ClosedPOs sheet?

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    this is what i have so far but its not copying the range, can someone take a look and see what the issue is?

    see the with newrow section for what is not working.

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: how to create a worksheet OPEN event to scan a sheet based on dates (expired)

    so i got this to work, like so:

    Please Login or Register  to view this content.
    thanks xlnitwit for pointing me in the right direction.

+ 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] vba to name command buttons on a userform based on cell value on worksheet open event
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-30-2016, 02:53 PM
  2. Need expired dates to be moved to a different work sheet
    By tward in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-07-2014, 04:40 PM
  3. Replies: 2
    Last Post: 03-03-2013, 12:46 PM
  4. Replies: 1
    Last Post: 03-02-2013, 01:48 PM
  5. Replies: 4
    Last Post: 10-05-2012, 07:52 AM
  6. open sheet based on cell value with event
    By Zheno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2011, 01:12 AM
  7. Replies: 2
    Last Post: 08-04-2010, 07:36 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