ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Enter date in column L if value is entered in column B (https://www.excelbanter.com/excel-programming/339143-enter-date-column-l-if-value-entered-column-b.html)

Mikus

Enter date in column L if value is entered in column B
 
I need macro that would enter date in column L if ANY value is entered in
column B

I think this code of Dave Peterson could be modified to acomplish this task

With Target
If .Cells.Count 1 Then Exit Sub 'one cell at a time
If Intersect(.Cells, Me.Range("b:b")) Is Nothing Then Exit Sub

On Error GoTo errHandler:

If IsNumeric(.Value) Then
'.Style = "Percent"
If .Value = 1 Then
Application.EnableEvents = False
With .Offset(0, 3)
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
End If
End If
End With

errHandler:
Application.EnableEvents = True

End Sub


Don Guillett[_4_]

Enter date in column L if value is entered in column B
 
you shouldn't need to start a new thread for this continuation question.

--
Don Guillett
SalesAid Software

"Mikus" wrote in message
...
I need macro that would enter date in column L if ANY value is entered in
column B

I think this code of Dave Peterson could be modified to acomplish this

task

With Target
If .Cells.Count 1 Then Exit Sub 'one cell at a time
If Intersect(.Cells, Me.Range("b:b")) Is Nothing Then Exit Sub

On Error GoTo errHandler:

If IsNumeric(.Value) Then
'.Style = "Percent"
If .Value = 1 Then
Application.EnableEvents = False
With .Offset(0, 3)
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
End If
End If
End With

errHandler:
Application.EnableEvents = True

End Sub





All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com