Hey guys I need a simple help.
Stuck with this.
I have tried combining but it is not working
Here are the 2 codes which I need to mearge :
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Application.EnableEvents = False
Cells(Target.Row, 17).Value = Date + Time
Application.EnableEvents = True
End If
Dim ws As Worksheet
Dim shp As Shape
Dim addr As Variant
Dim i As Long
Dim lastRow As Long
Dim tRng As Range
Dim shpName As String
Dim shpPath As String
Set ws = ActiveSheet
shpPath = filepath
If Right(shpPath, 1) <> Application.PathSeparator Then shpPath = shpPath & Application.PathSeparator
If Dir(shpPath) = "" Then MsgBox shpPath & " is invalid!", vbCritical, "INVALID PATH": Exit Sub
lastRow = WorksheetFunction.Max(2, ws.Cells(Rows.Count, "A").End(xlUp).Row + 2)
If Not Intersect(Target, Range("A2:A" & lastRow)) Is Nothing Then
Set tRng = Cells(Target.Row, "T")
If Target.Value = "" Then
On Error Resume Next
Me.Shapes("PictureAt" & tRng.Address).Delete
Err.Clear
On Error GoTo 0
Else
shpName = Target.Value
If Len(Trim(shpName)) > 0 Then
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
With tRng
.RowHeight = 56
.ClearContents
On Error Resume Next
Me.Shapes("PictureAt" & .Address).Delete
On Error GoTo 0
End With
If Dir(shpPath & Target & ".jpg") <> "" Then '* verify that the file exists
With tRng
Set shp = Me.Shapes.AddPicture(shpPath & shpName & ".jpg", msoFalse, msoCTrue, .Left, .Top, .Width, .Height)
shp.Name = "PictureAt" & .Address
End With
Else
tRng.Value = "NO IMAGE" & Chr(10) & "FOUND"
End If
End If
End If
End If
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
and
Private Sub Worksheet_Change(ByVal Target As Range)
If (Intersect(Target, Range("A1:G2")) Is Nothing) Then Exit Sub
If Range("A7:Z500000").CurrentRegion.Rows.Count > 1 Then
Range("A7:Z500000").CurrentRegion.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("A1:G2")
End If
End Sub
Bookmarks