Macro that will detemine date and then check off a box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top