Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2006

Tip: Looking for answers? Try searching our database.

programming a macro to display the current time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sherobot - 29 Sep 2006 22:28 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.