+ Reply to Thread
Results 1 to 14 of 14

Check Date to see if it has been Reached

  1. #1
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Check Date to see if it has been Reached

    Hello I have the following problem.

    I have dates listed in Column F. I need help creating a macro that will look through Column F and see which dates have passed or hsa been met based on the day the macro is run. If it finds a date that has passed or has been met then it will check Columns G and I and see if in that row those columns have any values. If either one of them do then the program will skip this date and go to the next date to check. If they are both empty then in the row with the current date being checked Column H receives a value of "Yes". Thanks for any help I can get on this.

  2. #2
    Registered User
    Join Date
    08-28-2014
    Location
    São Paulo
    MS-Off Ver
    2007
    Posts
    30

    Re: Check Date to see if it has been Reached

    So, as long as you name cell C8 with the =TODAY() function it should work. Does that help you or you need a function imputed inside the macro?

    Sub dateval()
    Dim lin As Integer
    Dim valor As Double

    lin = 1
    valor = Cells(lin, 6)
    While Cells(lin + 1, 6) <> Empty
    lin = lin + 1
    valor = Cells(lin, 6)
    If valor = Cells(8, 3) Or valor > Cells(8, 3) Then
    Cells(lin, 7) = "ok"
    End If
    Wend
    End Sub

  3. #3
    Registered User
    Join Date
    08-28-2014
    Location
    São Paulo
    MS-Off Ver
    2007
    Posts
    30

    Re: Check Date to see if it has been Reached

    Hey, it's better this way (I suppose)

    Sub dateval()
    Dim lin As Integer
    Dim valor As Double

    lin = 1
    valor = Cells(lin, 6)
    While Cells(lin + 1, 6) <> Empty
    lin = lin + 1
    valor = Cells(lin, 6)
    If valor = date Or valor > date Then
    Cells(lin, 7) = "ok"
    End If
    Wend
    End Sub


    Cheers

  4. #4
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    It works I just forgot to include one thing that is making it not work correctly for me. In column F there will be spaces in between some of the rows. So i would need it to run for the whole column say up to 5000 rows.

  5. #5
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    Actually hold on let me do some more tests.

  6. #6
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    Besides for that one thing from the last post. I'm noticing that its not noticing the right columns. If the date criteria is met then its suppose to check Columns G and I to see if they have any values in them. If either one of those columns do. Then Column H wont receive anything. If both columns G and I are empty after the date criteria is met then Column H will receive a "yes".

  7. #7
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    Ok I have the following code that works for the task I needed.
    Please Login or Register  to view this content.
    The problem i'm running into is that in cell(y,6) I have the following formula that is pulling the date:
    Please Login or Register  to view this content.
    How can I change the code or add to it that will read the cell correctly because right now it isn't reading it as a date.

  8. #8
    Registered User
    Join Date
    08-28-2014
    Location
    São Paulo
    MS-Off Ver
    2007
    Posts
    30

    Re: Check Date to see if it has been Reached

    How many blank spaces between dates would you have? I think it's a easier way to do it

  9. #9
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    It could vary no set number.

  10. #10
    Registered User
    Join Date
    08-28-2014
    Location
    São Paulo
    MS-Off Ver
    2007
    Posts
    30

    Re: Check Date to see if it has been Reached

    Are you using excel 2007?

  11. #11
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    No I'm using Excel 2013.

  12. #12
    Registered User
    Join Date
    08-28-2014
    Location
    São Paulo
    MS-Off Ver
    2007
    Posts
    30

    Re: Check Date to see if it has been Reached

    Could you try this?

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Check Date to see if it has been Reached

    I'm getting an error and that could be because in Column F it is not a normal Date value. Listed above I showed the formula that I have in there to pull a certain date for me. So with the code that I have thats working mostly I'm just trying to figure out how to make it read that cell correctly instead of looking for a date value.

  14. #14
    Registered User
    Join Date
    08-28-2014
    Location
    São Paulo
    MS-Off Ver
    2007
    Posts
    30

    Re: Check Date to see if it has been Reached

    You need the formula to be in date format, right?
    Does that help?

    Please Login or Register  to view this content.

+ 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. Return date at which a sum was reached
    By mihigh07 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-20-2020, 03:59 AM
  2. sending an email from excel when date is reached in a cell date
    By ldelafosse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2014, 08:58 PM
  3. Show the date when a sum is reached
    By jmm42278 in forum Excel General
    Replies: 1
    Last Post: 02-11-2014, 08:43 AM
  4. Replies: 1
    Last Post: 04-18-2012, 05:49 PM
  5. Replies: 2
    Last Post: 09-09-2011, 12:30 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