Forum Discussion
VBA coding help
- Mar 27, 2023
I've added the worksheet change event to your worksheet "Master Project List" for entries in range M6:M200. If i enter a value in any of these cells the current date and time is entered in the adjacent cell of column N.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngBereich As Range
Set rngBereich = Range("M100:M200")
If Target.Cells.Count > 1 Then GoTo done
If Not Application.Intersect(Target, rngBereich) Is Nothing Then
If Target.Value <> "" Then
Target.Offset(0, 1).Value = Now
Else
Target.Offset(0, 1).Value = ""
End If
End If
done:
Application.EnableEvents = True
Exit Sub
End SubYou can try this code. In the attached file you can enter data in a cell in range M100:M200 and the adjacent cell in column N returns the current date and time.
- OliverScheurichMar 23, 2023Gold Contributor
The code returns the expected result in my file. Can you attach your file without sensitive data?
- LilYawneyMar 27, 2023Brass Contributor
Sorry for the delayed response but here's a copy of the MPL Spreadsheet without any sensitive information!
- OliverScheurichMar 27, 2023Gold Contributor
I've added the worksheet change event to your worksheet "Master Project List" for entries in range M6:M200. If i enter a value in any of these cells the current date and time is entered in the adjacent cell of column N.