• 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.

Date and Time formulas for a log book

bbowes7

New Member
In column A i have a date and in column B i have a time, i would like these to automatically fill when i fill in column C. i have entered the formula to do just that but each time i enter info on a new line of the log all the dates and times update to the last log entry. How can i fix this?
 
bbowes7

Put the following code in a worksheet code page for the worksheet you want to enter your data

From the spreadsheet, Alt F11 and double click on the page Icon for your worksheet and paste the code in

=========================


Private Sub Worksheet_Change(ByVal Target As Range)


If (Target.Column) = 3 Then

Cells(Target.Row, 1).Value = Now 'Put the Current Date in this Row Column A

Cells(Target.Row, 1).NumberFormat = "dd mmm yyyy" 'Set the date Format

Cells(Target.Row, 2).Value = Now 'Put the Current Time in this Row Column B

Cells(Target.Row, 2).NumberFormat = "h:mm AM/PM" 'Set the Time Format

End If


End Sub
 
Back
Top