+ Reply to Thread
Results 1 to 2 of 2

run a macro 30 days from a specified date on workbook open

Hybrid View

  1. #1
    Registered User
    Join Date
    10-10-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    58

    run a macro 30 days from a specified date on workbook open

    hello everyone, i wanted to run a macro 30 days after I have saved my workbook from a specified date that i have saved on let's say cell "a1". any suggestions or tips? Thus 30 days from the specified date on "a1" as the workbook opens, it would run the macro.

    btw the macro is to protect the worksheet if you were wondering.


    thanks
    Last edited by union; 05-22-2014 at 07:56 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: run a macro 30 days from a specified date on workbook open

    Paste this in ThisWorkbook VBA window

    For 30 days exactly:
    
    Private Sub Workbook_Open()
    
    If Date - Sheets("Sheet1").Range("A1").Value = 30 Then
    'do this
    Else
    'do nothing
    End If
    
    End Sub


    or for past 29 days:

    
    Private Sub Workbook_Open()
    
    If Date - Sheets("Sheet1").Range("A1").Value > 29 Then
    'do this
    Else
    'do nothing
    End If
    
    End Sub
    Last edited by playaller; 05-22-2014 at 11:10 PM. Reason: typo VAB to VBA


    Shelton A.
    If Helpful, Add Reputaion!

+ 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 copy cells(Range) from an open Workbook to another open Workbook.
    By jbester in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2013, 09:47 AM
  2. Macro to open a closed workbook and select copy cells into an open workbook
    By helloganesh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2013, 02:00 PM
  3. Tracking open and closed projects - want days open or days to close
    By Aquaticape in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-07-2012, 08:18 PM
  4. [SOLVED] Macro to copy data from open workbook to next open line of new workbook
    By nhtodd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2012, 09:42 PM
  5. Always open workbook Macro to save as date and start a new day
    By JazzyBear in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2012, 08:08 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