+ Reply to Thread
Results 1 to 8 of 8

Workbook_Open Help

  1. #1
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Workbook_Open Help

    I have the following code in my Workbook

    Please Login or Register  to view this content.
    So basically when I run my excel file it calls the above macros. UpdateTime and UpdateDate refresh the current time and date every second. The other 3 macros rely on the current time/date to run. So when a date is within 2 days of the current date it will run the twodaysbeforeprices macro. But what I want to know is that if I open the excel sheet a week before anything is due to happen and leave the workbook open will the macros run themselves automatically once the date gets refreshed and is within 2 days of the cell that contains my date? OR, would I have to use another code such as Workbook_Calculate or something along those lines to make what I want work???

    Thanks in advance.

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Workbook_Open Help

    Hello there,

    You would need to run a different code as this code only accounts for the On Workbook Open event.

  3. #3
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Workbook_Open Help

    What code would I need?

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Workbook_Open Help

    It's a little hard to imagine your workbook but I believe the On Calculate Event should work if you leave the workbook open.

  5. #5
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Workbook_Open Help

    Thanks for your help rvasquez. So in my workbook I should have the below code or am I wrong?

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Workbook_Open Help

    Yes, I believe that should work for you. But this also assumes that you will not be entering data or manipulating any cells in the meantime or else the code will run everytime you do so.

  7. #7
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Workbook_Open Help

    I tried it there but when I changed the date in the cell to make it within 2 days it didn't run the macro. Should the OnCalculate code be in the workbook or the module itself and if it's in the module does anything additional need to be placed in the Workbook code?

  8. #8
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Workbook_Open Help

    Try the on worksheet change event

    Please Login or Register  to view this content.
    This should be in the same area as your on workbook open Event. Under ThisWorkbook.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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