Hello,
I've received and modified a simple VBA from another excel and i was wondering if anyone could help me modify even more. The thing i need is that the range of this code would be across all documents worksheets.
I1,I2,I3 stays in the first sheet. Date and Name in any other if I2 or I3 match is found.
Thank you for any help or tips.
I've received and modified a simple VBA from another excel and i was wondering if anyone could help me modify even more. The thing i need is that the range of this code would be across all documents worksheets.
I1,I2,I3 stays in the first sheet. Date and Name in any other if I2 or I3 match is found.
Code:
Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range
Dim lCol As Long
On Error GoTo Terminate
Select Case Target.Address(0, 0)
Case "I2"
lCol = 2
Case "I3"
lCol = 4
Case Else
lCol = 0
End Select
If Not lCol = 0 Then
Application.EnableEvents = False
Set c = Range("F:F").Find(What:=Target.Value)
If c Is Nothing Then
MsgBox Target.Value & " not found", vbExclamation + vbOKOnly
Target.Select
Else
Cells(c.Row, lCol).Value = Date
Cells(c.Row, lCol + 1).Value = Range("I1").Value
End If
Target.ClearContents
End If
Terminate:
Application.EnableEvents = True
End Sub
Thank you for any help or tips.