Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automatic date or time in forms

I'm trying to get an automatic date or time into a userform. Can someone help
me with this.
--
Thanks,
Marjan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automatic date or time in forms

Private Sub Userform_Activate()
label1.Caption = format(now,"mm/dd/yyyy hh:mm")
End sub

if you want it to update periodically, look at Chip Pearson's page on the
use of OnTime. You could start it off in the activate event.

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy


"marjan" wrote in message
...
I'm trying to get an automatic date or time into a userform. Can someone

help
me with this.
--
Thanks,
Marjan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automatic date or time in forms

When I use this option users can not adjust this cell. How can I get it
adjustable.
--
Thanks,
Marjan


"Tom Ogilvy" wrote:

Private Sub Userform_Activate()
label1.Caption = format(now,"mm/dd/yyyy hh:mm")
End sub

if you want it to update periodically, look at Chip Pearson's page on the
use of OnTime. You could start it off in the activate event.

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy


"marjan" wrote in message
...
I'm trying to get an automatic date or time into a userform. Can someone

help
me with this.
--
Thanks,
Marjan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automatic date or time in forms

Use a textbox instead:

Private Sub Userform_Activate()
Textbox1.Value = format(now,"mm/dd/yyyy hh:mm")
End sub


"marjan" wrote in message
...
When I use this option users can not adjust this cell. How can I get it
adjustable.
--
Thanks,
Marjan


"Tom Ogilvy" wrote:

Private Sub Userform_Activate()
label1.Caption = format(now,"mm/dd/yyyy hh:mm")
End sub

if you want it to update periodically, look at Chip Pearson's page on

the
use of OnTime. You could start it off in the activate event.

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy


"marjan" wrote in message
...
I'm trying to get an automatic date or time into a userform. Can

someone
help
me with this.
--
Thanks,
Marjan






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic date or time in forms


If you're wanting your DTPicker (or whatever you're using) to default to
the current date, you can use the following code:

Private Sub UserForm_Initialize()
dtpDate.Value = Now
End Sub


HTH


DejaVu


--
DejaVu
------------------------------------------------------------------------
DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629
View this thread: http://www.excelforum.com/showthread...hreadid=376111



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Automatic date or time in forms

I have made use this line of code:-

Textbox1.Value = format(now,"mm/dd/yyyy")

to complete a textbox in a UserForm, however it only works for me some
people on my team it seems. For others it brings up a Compile Error 'can't
find Project or library..???

Is this anything to do with Addins or Excel options?

I have also used:-

Textbox1.Value = Date

but the effect seems to be the same. Can anybody help me understand why?
or can I fill the textbox from a single cell on a sheet (with ' =Today() '
in the cell)?

I know this is an old thread but it shows that I do search for an answer
before posting ;-)

Thank you in advance

Damon

"Tom Ogilvy" wrote:

Use a textbox instead:

Private Sub Userform_Activate()
Textbox1.Value = format(now,"mm/dd/yyyy hh:mm")
End sub


"marjan" wrote in message
...
When I use this option users can not adjust this cell. How can I get it
adjustable.
--
Thanks,
Marjan


"Tom Ogilvy" wrote:

Private Sub Userform_Activate()
label1.Caption = format(now,"mm/dd/yyyy hh:mm")
End sub

if you want it to update periodically, look at Chip Pearson's page on

the
use of OnTime. You could start it off in the activate event.

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy


"marjan" wrote in message
...
I'm trying to get an automatic date or time into a userform. Can

someone
help
me with this.
--
Thanks,
Marjan






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms / Templates - automatic sending tonyagrey Excel Discussion (Misc queries) 1 April 15th 10 12:07 PM
Automatic Time and Date Larry[_7_] Excel Worksheet Functions 10 August 20th 08 11:11 AM
Automatic date and time updation Qlychap Excel Discussion (Misc queries) 12 July 21st 06 02:57 PM
excel, automatic date and time when info gets entered shorty Excel Worksheet Functions 4 April 26th 06 06:46 PM
Automatic Vlookups in Forms savv32 Excel Programming 2 January 16th 04 03:16 AM


All times are GMT +1. The time now is 05:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"