Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Microsoft Office support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Microsoft Office support MS Office support forum

Reply
 
LinkBack Thread Tools
Old 01-05-2008, 02:02 PM   #1 (permalink)
Registered User
 
Join Date: Jan 2008
Posts: 6
OS: windows xp pro


[SOLVED] Userforms in Excel

I have been attempting to automate some data entry into daily logs. While Access would be more ideal, this group of people will only use Excel. So, I have experimented with Userforms for entering data into excel spreadsheets by finding some VBA code and modifying it. My question is this:

How can I get Excel to allow a field in the Userform to have a default date/time value when the Userform is opened?

Previous attempts: Tried to used the control source in the field's property box, which would pull the current time in from the main spreadsheet. However, if the individual needs to put in a different time, then the original field in the spreadsheet is written over with the new value...thus killing any date functions already existing in that spreadsheet cell.

Side note: any good resources for working with Userforms in Excel? My keyword searches have had poor results.

Thanks,
Stag
StagColumbus is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 01-05-2008, 02:47 PM   #2 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,482
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
Re: Userforms in Excel

Hi and welcome to TSF.

I usually add in today's date when the workbook opens and the form is initialised, but it's just a case of adapting the formatting for time, and lock the field
Code:
With UserForm1.TextBox1
    .Value = Format(Now(), "hh:mm:ss")
    .Locked = True
End With
This assumes you use a Textbox on the form.

Let me know if this helps.
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 01-05-2008, 05:00 PM   #3 (permalink)
Registered User
 
Join Date: Jan 2008
Posts: 6
OS: windows xp pro


Re: Userforms in Excel

IAIN,

Great! That allowed me to fix several similar date/time issues on the different input forms I am creating.

I also appreciate the quick response! I'm in the office this weekend to get this idea right for Monday...now I just might make it! :))

Thanks!
Stag
StagColumbus is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 03-25-2009, 04:15 PM   #4 (permalink)
Registered User
 
Join Date: Mar 2009
Posts: 2
OS: XP


Re: Userforms in Excel

Quote:
Originally Posted by Glaswegian View Post
Hi and welcome to TSF.

Code:
With UserForm1.TextBox1
    .Value = Format(Now(), "hh:mm:ss")
    .Locked = True
End With
This assumes you use a Textbox on the form.

Let me know if this helps.
This looks very close to what I need to do. If the text box this refers to is named "IssueDate" how would I reference that? I tried "With UserForm1.IssueDate" but it gave me errors.

Also, all of my code executes upon clicking the OK button... how do I set it so this runs when the form is started?

Thanks in advance.
mseaver is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 03-26-2009, 07:13 AM   #5 (permalink)
Moderator/ Rangemaster TSF Academy; Analyst, Security Team; Oor Wullie; TSF Surgeon and Resident Comic
 
Glaswegian's Avatar
 
Join Date: Sep 2005
Location: Glasgow
Posts: 25,482
OS: Win XP Pro SP3 / Win 7 Pro

My System

Blog Entries: 10
Re: [SOLVED] Userforms in Excel

Hi and welcome.

Is your form named 'UserForm1' or something else? Can you post the code you are using?
__________________
Iain - Defender of the Haggis and all things Scottish.
I don't help by PM - post in the Forums.



PC Safety & Security::PC running a bit slow?::Donate::Photographers Corner
Glaswegian is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 03-26-2009, 02:59 PM   #6 (permalink)
Registered User
 
Join Date: Mar 2009
Posts: 2
OS: XP


Re: [SOLVED] Userforms in Excel

Actually, I found a workaround that doesn't require the default value to be set. Thanks, though!
mseaver is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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




All times are GMT -7. The time now is 11:35 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85