+ Reply to Thread
Results 1 to 4 of 4

Check DateDiff on Each Worksheet

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    Virginia, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Check DateDiff on Each Worksheet

    Hello everyone, I am attempting to create a macro that will check each worksheet in a workbook to see if the expire date in field B2 is less than 30 days away. The problem that I am having is the with each worksheet section. If any of the worksheets are within 30 days, it activates every single worksheet in the entire workbook and gives the MsgBox, instead of just activating the one(s) that are within 30 days. Thanks for any help you can provide and if you need more information, just let me know!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Check DateDiff on Each Worksheet

    Consider:

    Please Login or Register  to view this content.
    Gary's Student

  3. #3
    Registered User
    Join Date
    03-27-2014
    Location
    Virginia, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Check DateDiff on Each Worksheet

    Thanks Jak, I never thought to move DateDiff into For Each! Had to change it up a little because I was getting a type mismatch error on ws.Range("B2") but here is the code that ended up working for me:

    Please Login or Register  to view this content.
    Last edited by borasko34; 04-02-2014 at 10:26 AM.

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Check DateDiff on Each Worksheet

    Good Job! ........................................

+ 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. DateDiff
    By YBrazeau in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-31-2009, 12:09 PM
  2. DateDiff
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2006, 03:12 AM
  3. DateDiff
    By RetepNamenots in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-16-2006, 04:03 PM
  4. DateDIFF
    By Paul Breslin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2005, 11:15 AM
  5. Help with datediff vba
    By John in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2005, 10:42 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