Jagat Pavasia
Active Member
- Joined
- Mar 9, 2015
- Messages
- 412
- Office Version
- 2021
- Platform
- Windows
hi sir,
I have Macro below, it is working as it should.
but now I want currant date and time instead of only date.
please edit and give me, I am new in Macro.
I have Macro below, it is working as it should.
but now I want currant date and time instead of only date.
please edit and give me, I am new in Macro.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
ActiveSheet.Unprotect
Set Rng = Range("b:b,g:g,i:i,k:k,m:m")
If Not Intersect(Target, Rng) Is Nothing Then
If Target.Value = "**" Then Target.Value = Format(Now, "MM/DD/YYYY")
End If
If Not Intersect(Target, Range("a2:n2")) Is Nothing Then
If Target.Value = "" Then
ActiveSheet.Range("a4:n4").AutoFilter Field:=Target.Column
Else
ActiveSheet.Range("a4:n4").AutoFilter Field:=Target.Column, Operator:=xlFilterValues, Criteria1:=CStr(Target.Value)
End If
End If
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFiltering:=True
Application.EnableEvents = True
End Sub