Jun 12 2023 05:50 AM
Jun 12 2023 06:06 AM
Let's say you enter OK in column D, from D2 down, and you want the date plus text in column E.
Set the number format of column E to the custom format
"Paid on "dd-mm-yyyy
Right-click the sheet tab.
Select 'View Code' from the context menu.
Copy the code listed below into the worksheet module.
Switch back to Excel.
Save the workbook as a macro-enabled workbook (*.xlsm).
Make sure that you allow macros when you open the workbook.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Not Intersect(Range("D2:D" & Rows.Count), Target) Is Nothing Then
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each rng In Intersect(Range("D2:D" & Rows.Count), Target)
If rng.Value = "OK" Then
rng.Offset(0, 1).Value = Date
Else
rng.Offset(0, 1).ClearContents
End If
Next rng
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Jun 19 2023 03:10 AM
Jun 19 2023 03:24 AM
Select column E, then click the arrow in the lower right corner of the Number group on the Home tab of the ribbon.
Select Custom in the Category list, then type
"Paid on"dd-mm-yyyy
in the Type box.
Click OK.
See the attached demo workbook. You'll have to allow macros when you open it.
Jul 21 2023 05:39 AM