ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro that will detemine date and then check off a box (https://www.excelbanter.com/excel-worksheet-functions/160701-macro-will-detemine-date-then-check-off-box.html)

Wendy

Macro that will detemine date and then check off a box
 
I have a cell titled Commit Date that you will fill in a date. At the top of
the spreadhseet I have the current date. I need a macro that takes the
current date plus 7 days and checks a box off (Lists it as a Focus Item) if
the commit date falls within that date range.

I'm new at macros and am completley lost on this one. Any help would be
greatly appreciated!

Thank You, Wendy

Bob Phillips

Macro that will detemine date and then check off a box
 
Wendy,

I am not sure what you mean by checks a box off (Lists it as a Focus Item),
but this code puts a tick besaide the date if it meets.

It assumes Commit Date is in C3, and sets the tick when it cahnges.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C3" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = Date And .Value <= Date + 7 Then
.Offset(0, 1).Value = "a"
.Offset(0, 1).Font.Name = "Marlett"
Else
.Offset(0, 1).Value = ""
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Wendy" wrote in message
...
I have a cell titled Commit Date that you will fill in a date. At the top
of
the spreadhseet I have the current date. I need a macro that takes the
current date plus 7 days and checks a box off (Lists it as a Focus Item)
if
the commit date falls within that date range.

I'm new at macros and am completley lost on this one. Any help would be
greatly appreciated!

Thank You, Wendy





All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com