Date and time stamp, control button
Private Sub CommandButton1_Click()
Const SHEET_NAME As String = "mylog" '<=== change to suit
Dim sh As Worksheet
Dim this As Worksheet
Dim iNext As Long
Set this = ActiveSheet
On Error Resume Next
Set sh = Worksheets(SHEET_NAME)
On Error GoTo 0
If sh Is Nothing Then
Worksheets.Add.Name = SHEET_NAME
Set sh = Worksheets(SHEET_NAME)
iNext = 1
Else
iNext = sh.Cells(Rows.Count, "A").End(xlUp).Row + 1
End If
sh.Cells(iNext, "A").Value = Now
sh.Cells(iNext, "A").NumberFormat = "dd mmm yyyy hh:mm:ss"
this.Activate
End Sub
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"MattB" wrote in message
...
I have a speardsheet I use to track sales calls. As of now it only tracks
totals by means of a control button that acts as a counter. (upon clicking
the button, it adds "1" to a cell for a total.) What I would like to do is
add to the control button so that each click is recorded seperately and
date
and time stamped, preferably on a seperate sheet. any suggestions? (I'm
not
the most educated on Visual Basics, I would be more than happy to e-mail
what
I have now if that would be easier.)
|