Tying to Edit Code

Frith

Board Regular
Joined
Nov 1, 2009
Messages
99
Hi,

Would anyone know how to have this code execute only ONCE? As it is, it auto-enters a date-stamp EVERY time a cell in column B is double-clicked. I just need it to do this ONLY on the INITIAL cell edit.

Thanx!
Frith


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim TimeStr As String
If Target.Column = 1 Then
Target.Offset(, 1) = Now
End If
If Target.Column = 1 Then
Target.Offset(, 3) = Now
End If
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try

Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim TimeStr As String
With Target
    If .Column = 1 Then
        If Len(.Offset(,1)) = 0 then 
            .Offset(, 1) = Now
            .Offset(, 3) = Now
        End If
    End If 
End With

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,541
Messages
6,179,418
Members
452,912
Latest member
alicemil

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