Can someone tell me how to code a macro to display the current time is a
cell. I am able to get the date and time with using the Now coding, but can't
seem to get the only the hours and the minutes. I know this is an easy
fix...but help I'm a newbie
Jim Thomlinson - 29 Sep 2006 22:53 GMT
MsgBox Time()
or
Sheet1.Range("A1").Value = Time()

Signature
HTH...
Jim Thomlinson
> Can someone tell me how to code a macro to display the current time is a
> cell. I am able to get the date and time with using the Now coding, but can't
> seem to get the only the hours and the minutes. I know this is an easy
> fix...but help I'm a newbie
sherobot - 30 Sep 2006 00:18 GMT
I'm getting Expected value or varible when I put in this code. Do i need to
add something else? sorry for being so green at this.
> MsgBox Time()
> or
[quoted text clipped - 4 lines]
> > seem to get the only the hours and the minutes. I know this is an easy
> > fix...but help I'm a newbie
JLGWhiz - 30 Sep 2006 17:21 GMT
I used these :
Sub tm()
MsgBox Time()
End Sub
Sub wstime()
Sheet2.Range("A1").Value = Time()
End Sub
They both gave me the time with no error message. Just copy these and see
if they work for you.
> I'm getting Expected value or varible when I put in this code. Do i need to
> add something else? sorry for being so green at this.
[quoted text clipped - 7 lines]
> > > seem to get the only the hours and the minutes. I know this is an easy
> > > fix...but help I'm a newbie
JLGWhiz - 30 Sep 2006 17:29 GMT
I used the code in the code module for VBA. If you are trying to enter into
the worksheet cell, it is a different procedure.
> Can someone tell me how to code a macro to display the current time is a
> cell. I am able to get the date and time with using the Now coding, but can't
> seem to get the only the hours and the minutes. I know this is an easy
> fix...but help I'm a newbie