+ Reply to Thread
Results 1 to 13 of 13

VBA code for checking a specific date occur.

Hybrid View

  1. #1
    Registered User
    Join Date
    02-17-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2007
    Posts
    45

    VBA code for checking a specific date occur.

    Hi all,

    I would be very happy if somebody can help me with the following task:

    Have a single sheet. In coloumn "A" are posted some dates.In range "B1" I have a formula that gives today`s date, in other words B1 = today. Is it possible when I activate the sheet to check a week back from the value in range "B1" and if there is a value in coloumn A range that contains in this condition to recieve a msgbox with specific text.

    Thnak u in advance.
    Last edited by ExcelBG; 10-22-2015 at 08:43 AM.

  2. #2
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Hi,
    Yes, it's possible, but can you upload an example here?
    Greetings,

    Cheetahke

  3. #3
    Registered User
    Join Date
    02-17-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA code for checking a specific date occur.

    Hi Cheetahke,

    Here is the file...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Hi,

    Here's the file with the search in, be sure you have macro's enabled, otherwise it won't work.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-17-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA code for checking a specific date occur.

    It does not make any thing. Any suggestions?

  6. #6
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Hi,

    I've changed a little bit in the code, can you try again?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-17-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA code for checking a specific date occur.

    Hi Cheetahke,

    I appreciate your help. Now the vba code is working, but there is something that was misunderstanding. The vba code works only for one date in our case this date is:
     searchDate = DateValue(.Range("B1") - 7)
    and it returns as a answear 15.10.2015, but if this date does not exist we have six dates more that meet the requirement and the code does not consider this.

    Nevertheless thank you for your help.

  8. #8
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Hi,

    but if this date does not exist we have six dates more that meet the requirement and the code does not consider this.
    Sorry, but this was not clear in you question, nor in your example of the workbook. What are those six dates? Are those the days of the whole week?
    If so, I'll change the code for searching.

  9. #9
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Hi,

    but if this date does not exist we have six dates more that meet the requirement and the code does not consider this.
    Sorry, but this was not clear in you question, nor in your example of the workbook. What are those six dates? Are those the days of the whole week?
    If so, I'll change the code for searching.

  10. #10
    Registered User
    Join Date
    02-17-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA code for checking a specific date occur.

    Hi,
    Yes those are the days for the whole week.

  11. #11
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Hi,

    Is this what you need?
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    02-17-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA code for checking a specific date occur.

    Now it is working perfect.
    A lot of tnx Cheetahke! Wish u all the best.

  13. #13
    Registered User
    Join Date
    10-10-2015
    Location
    Hoboken, Antwerp, Belgium
    MS-Off Ver
    2010
    Posts
    93

    Re: VBA code for checking a specific date occur.

    Will you please click on the star beneath my last post to add reputationpoints if you like my work?

+ 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. Replies: 5
    Last Post: 08-17-2015, 05:38 AM
  2. program a formula to count number of times event occur before a specific time.
    By yinxzon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2014, 04:15 AM
  3. How to add values based on date they occur?
    By browndog in forum Excel General
    Replies: 1
    Last Post: 03-16-2014, 06:02 PM
  4. Error Occur when write .Range Code
    By gingank in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 09:57 PM
  5. Checking Date in Macro Code
    By mmwtx in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-09-2009, 11:18 PM
  6. Replies: 4
    Last Post: 06-16-2006, 11:20 PM
  7. Color Code Date Checking
    By drvortex in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-01-2006, 03:35 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