View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default finding dates in a range

You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub MyMacro()
Dim lngRow As Long
For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("C" & lngRow) 0 Then
If DateDiff("d", Range("C" & lngRow), Date) <= 365 Then
MsgBox Range("A" & lngRow), , "Less then 1 Year"
End If
End If
Next
End Sub


--
Jacob


"NigelShaw" wrote:

Hi,

This is related to VBA

i need to try and find a date in range ("C:C"). if the date =< todays date +
365 ie 12 months or less, flash a message with the name in the same row but
in column ("A:A").

firstly, is this achievable? im an access VBA person and havent done excel
for a long time :(
secondly, if it is, can it loop through the rows in column C until it
reaches the end and flash a message for each date hitting this condition?


hope someone an help :)


Nigel