Jagat Pavasia
Active Member
- Joined
- Mar 9, 2015
- Messages
- 406
- Office Version
- 2021
- Platform
- Windows
Dear sir, I have 2 VBA code,
Please Help me to Merge it, so that I will not get Error.
VBA code is Below
ANOTHER VBA IS BELOW :
Please Help me to Merge it, so that I will not get Error.
VBA code is Below
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Intersect(Target, Range("D7:J2500 ,L7:M2500")) Is Nothing Then Exit Sub
Select Case Target.Column
Case 4 To 10
If Target <> "" Then
With Target.Offset(, 14)
.Value = Now()
.NumberFormat = "dd/mm/yy hh:mm AM/PM"
End With
Else
Target.Offset(, 14).ClearContents
End If
Case Is = 12, 13
If Target <> "" Then
With Target.Offset(, 13)
.Value = Now()
.NumberFormat = "dd/mm/yy hh:mm AM/PM"
End With
Else
Target.Offset(, 13).ClearContents
End If
End Select
Application.ScreenUpdating = False
End Sub
ANOTHER VBA IS BELOW :
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("q:q")
If Not Intersect(Target, rng) Is Nothing Then
If Target.Value = "**" Then Target.Value = Format(Date, "mm/dd/yyyy")
End If
If Not Intersect(Target, Range("A5:O5")) Is Nothing Then
If Target.Value = "" Then
ActiveSheet.Range("A7:O7").AutoFilter Field:=Target.Column
Else
ActiveSheet.Range("A7:O7").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