Help : Macro for capturing current system time

  • Thread starter Thread starter imr
  • Start date Start date
I

imr

Hi,

I am currently working on an excel worksheet. It requires
macro button for capturing the system time at that particular moment i
certain columns. I would like to know how to solve this problem i
coding the macro for such a functionality. Please help me.

Regards
IM
 
Hi Vasant,

Thanks for the solution, but it works for the particular cel
alone. It appears that i have to code for each cell.

Is there anyway to generalise the code, so that wherever i click on th
worksheet, the system time at that particular moment is updated and th
cell is also protected after this.

Please do let me know.

Regards
im
 
I'm a bit confused ... do you want this to happen for every cell on the
worksheet?

In any event there is no good way to capture a click on a worksheet. You can
capture a double-click or a right-click, for example:

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Cancel = True
Target = Time
End If
End Sub

Placing this code in the worksheet code module will cause any cell in column
A to be updated with the system time when double-clicked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top