• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

What Event?

Hi all

here i have attached a sheet where i am trying to put some vba automation but i am confused.
i need to insert the current time when i select the value from drop down in the column "C"
i am confuse about the event, what type of event should i use for this.

any idea please suggest.


Thanks in advance
Nipendra
 

Attachments

  • Start_Time.xlsx
    11.2 KB · Views: 2
Is Worksheet_Change event is not working..!!:eek:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
    If Target.Column = 3 Then
        Target.Offset(, 3) = Now()
    End If
Application.EnableEvents = True
End Sub
 
Yes thanks it is superb but is it possible by the formula also, because whenever i am trying with Now() function and going to the next value to select it is updating the last time also. i am trying with "=IF(C2="","",NOW()-TODAY())".

any idea

Nipendra
 
Hi Nipendra..

Sorry.. not able to understand.. do you want only time, when it was las updated..
or the time gap between last update and this..
 
the code which you have provided it is working fine.
now i am trying to do it by excel formula like in the attached file if the dropdown is not empty then it should show the start time else it should be empty. however it is working fine but when i am trying to drag the formula below and going to select the second value in the second row it is updating the above formula as well.
sorry for the poor language
Regards
Nipendra
 

Attachments

  • Timesheet.xlsm
    119.8 KB · Views: 4
Hi Nipendra..

Its lil bit hard to manage with FORMULA only.. you have to set up.. some iteration and logic..

VBA is easy in this scenario..

try t his..
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
    If Target.Column = 3 Then
        Target.Offset(, 3).Value2 = Format(Now, "hh:mm:ss")
    End If
Application.EnableEvents = True
End Sub
 
Back
Top