VB script for Current time

H

hn.srikanth

Hi there,
I wanted current time to be dispalyed in active cell. So I created a
Command button and wrote the following script, though its working
fine, when ever i click the button, time in all the cells are getting
updated to current time. But I want the current time only in cell
where cursor is there. Can any one assit please...
Scrip:-
sub
commondbutton1_Click
activecell.formula="=now()"
end sub

Thanks in advance!
Sriki
 
S

Sheeloo

That is because you are putting the formula
=NOW() in the cells

Use
Private Sub CommandButton1_Click()
ActiveCell = Now()
End Sub
 
H

hn.srikanth

That is because you are putting the formula
=NOW() in the cells

Use
Private Sub CommandButton1_Click()
ActiveCell = Now()
End Sub

----------------------
Click 'Yes' if this helps.






- Show quoted text -

Thank you so very much.. It's working...
 

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