I am trying with VBA to get the current date on column H (Date) but It does not work well. here is the problem
- In column F (Result) if I manually type Preferred or Non-preferred. after press Enter today date will be automatically put on column H (Date)
- But when I paste formula instead (which will consider data from column A-E to show result on its cell). even if the result give Preferred or Non-preferred the date will not automatically show up like VBA cannot detect that. unless I press double-click and enter on each result cell then it will show up. can someone figure it out please
this is vba that i use
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Dim St As String
St = "Preferred|Non-Preferred"
If Not Intersect(Columns("F"), Target) Is Nothing Then
Application.EnableEvents = False
For Each c In Intersect(Columns("F"), Target).Cells
If InStr(1, St, c.Value, vbTextCompare) >= 1 Then
Cells(c.Row, "H").Value = Date
Else
If IsEmpty(c) Then Cells(c.Row, "H").Value = ""
End If
Next c
Application.EnableEvents = True
End If
End Sub
