View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Charles Chickering Charles Chickering is offline
external usenet poster
 
Posts: 272
Default Inserting static times into cells using command buttons

I'll assume you know nothing about macro's so forgive me if this is too simple.
Open your workbook, then press Alt+F11, which opens the VBA editor
Go to Insert, Module
In the code window that appears paste this code:
Sub AddTime()
ActiveCell = Now()
End Sub

Go back to Excel
From the "Forms" Toolbar, create a Command Button
When Excel asks you what macro to run with this button,
choose "AddTime"
Select the cell you want the time in and Click the button
--
Charles Chickering

"A good example is twice the value of good advice."


"rossmac2" wrote:

Does anyone know how to do the above? Or have a piece of visual basic code
that i could adapt to do this?