Hello,
I am attempting to allow cell M6 to remain blank for manual entry as well as autofill based on the value of another cell.I have attempted 2 version of code that I loaded into the sheet code, but neither work. If cell L4 = N, cell M6 stays blank. If L4 = Y, then cell M6 get a formula of NOW & another cells contents to create a unique value. I'm fairly new to coding. Any help will be greatly appreciated.
Private Sub Worksheet_Change(ByVal target As Range)
If Range("L4").Value = "N" Or .Value = "" Then Exit Sub
Application.EnableEvents = False
If Range("L4").Value = "Y" Then
ActiveSheet.Range("M6").Formula = "=text(NOW(),""mm/dd/yy/h:mm"")"
Application.EnableEvents = True
End Sub
Version 2
Private Sub Worksheet_Change(ByVal target As Range)
If .Range("L4").Value = "N" Then
.Range("M6").Value = ""
ElseIf .Range("L4").Value = "Y" Then
.Range("M6").Formula = "=text(NOW(),""mm/dd/yy/h:mm"""
End With
End Sub
Bookmarks