How do you add "Ctrl+Shift+;" to a button?

R

rguthrie

Concerning the tip - "To enter the current time in a cell, select a cell
and press Ctrl+Shift+;" - I would like to know how to add this command
to a button as shown by the attached file. I've attached a screen shot
showing the button location and the column in which I'd like to be able
to have the current time entered into the selected cell.

I'm not a Visual Basic user so I don't know if/how it can be added. The
way I'd like the button to perform is to click on a cell in the column
below the button; click the button; and the current time is entered.

I guess what I'd hope to get from someone is the exact content of the
macro and the insructions to implement in the Visual Basic Editor. In
other words, what do I need to do after I right click on the button and
choose "Assign Macro..."

Thanks!
 
H

Harald Staff

Hi

Open the VB editor (Alt F11 or wiht the Tools > Macro menu).
Insert a module (Inser menu in the editor.
Paste this in:

Sub AddTime()
Cells(2, 3).Value = TimeValue(Now)
End Sub

Return to the sheet, assign the macro to the button. Alter the cell address
Cells(Rownumber, Columnnumber) to fit your needs. Or replace with

ActiveCell.Value = TimeValue(Now)

if you want the selected cell at all times.
 
B

BS

Hi;
Sub Date()
Application.SendKeys ("+^;~")
End Sub

This macro does the job (Ctrl+Shift+;) with the selected cell

Search "SendKeys" in excel help and you will find more.

Burçin SARIHAN
 

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

Top