buddygunner
New Member
- Joined
- Dec 12, 2015
- Messages
- 5
I require a Macro that will auto highlight new entries made to an excel sheet for a set time. can any body help on this?
Private Sub Worksheet_Change(ByVal Target As Range)
Const ColumnForDate As String = "C"
Dim r As Range
If Target.Count > 1 Then Exit Sub
Set r = Intersect(Target.EntireRow, Columns(ColumnForDate))
If Not r Is Nothing Then
If r.Value = vbNullString Then r.Value = Now
End If
End Sub
The Conditional Formatting equation I used was:
=$C1>NOW()-(1/8640)
That removes the highlighting after 10 seconds.
An on another note,
I also require a macro that will enter the current date & time into a cell when that cell is clicked. if at all possible
Private Sub Worksheet_Change(ByVal Target As Range)
Const ColumnForDate As String = "C"
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
If Target(1, ColumnForDate) = vbNullString Then Target(1, ColumnForDate).Value = Now
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Const ColumnForDate As String = "C"
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
If Target(1, ColumnForDate) = vbNullString Then Target(1, ColumnForDate).Value = Now