Automatically insert date and remove it

keithbc

New Member
Joined
Mar 16, 2009
Messages
26
Hi

When entering a random 7 digit number in column K, i want the date to appear in column N, when this number is deleted i want the date to be deleted aswell
Any help would be appreciated.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 11 Then
    Application.EnableEvents = False
    Select Case Target.Value
        Case "": Target.Offset(, 3).ClearContents
        Case Else: Target.Offset(, 3).Value = Date
    End Select
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 11 Then
    If Len(Target) > 0 Then
        Cells(Target.Row, 14) = Date
    Else: Cells(Target.Row, 14).ClearContents
    End If
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Hi

When entering a random 7 digit number in column K, i want the date to appear in column N, when this number is deleted i want the date to be deleted aswell
Any help would be appreciated.

You could use the following formula in N1 and copy down....

Code:
=IF(LEN(K1)=7,TODAY(),"")

Remember to ensure the formatting of column N is set to date

:)
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,331
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top