Ok, I’m finally taking the plunge and attempting to create a UserForm, but I am unsure of the coding.
I want the userform to open with a specific workbook and I want both the users name and supervisors name to be entered prior to continuing. Preferably, where this cannot be bypassed in any way, where each input box should contain both first and surname (Is it possible to only continue if say a minimum of 7 characters were entered, including a compulsory space, so the bare minimum would be ‘Ted Fox’ for example). Then assign the names to specific cells. I have attached what I have thus far.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
UserForm (2002)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » UserForm (2002)
- This topic has 7 replies, 3 voices, and was last updated 16 years, 11 months ago.
AuthorTopicWSVegasNath
AskWoody LoungerJune 27, 2008 at 12:24 am #452027Viewing 0 reply threadsAuthorReplies-
WSJezza
AskWoody LoungerJune 27, 2008 at 12:34 am #1114653Nathan
Add this code to the command button:
Private Sub CommandButton1_Click() Dim intUser As Integer Dim intSup As Integer intUser = Range("A" & Rows.Count).End(xlUp).Row intSup = Range("B" & Rows.Count).End(xlUp).Row Cells(intUser + 1, 1).Value = TextBox1.Value Cells(intUser + 1, 2).Value = TextBox2.Value End Sub
I am making the assumption you want to add the details of the user and the supervisor in columns A and B
-
WSVegasNath
AskWoody Lounger -
WSJezza
AskWoody LoungerJune 27, 2008 at 1:00 am #1114660Hi Again
I have been working on this as you were typing to add validation and I will adapt it to answer your question:
Private Sub CommandButton1_Click() If Len(TextBox1) < 7 Then MsgBox "The User Name must be at least 7 letters long" TextBox1.Value = "" TextBox2.Value = "" Exit Sub End If If Len(TextBox2) < 7 Then MsgBox "The Supervisor's Name must be at least 7 letters long" TextBox1.Value = "" TextBox2.Value = "" Exit Sub End If If InStr(1, TextBox1, " ", 1) = 0 Then MsgBox "Please enter a surname in the User box" End If If InStr(1, TextBox2, " ", 1) = 0 Then MsgBox "Please enter a surname in the supervisor box" End If Cells(1, 1).Value = TextBox1.Value Cells(1, 2).Value = TextBox2.Value End Sub
If you have specific cells to add the values to you can just adjust
Cells(1, 1).Value = TextBox1.Value
Cells(1, 2).Value = TextBox2.Valueusing the syntax
Cells([Row Value], [Column Value])
I hope that is clearer
-
WSVegasNath
AskWoody Lounger -
WSVegasNath
AskWoody LoungerJuly 2, 2008 at 9:41 am #1115467Jerry,
Thanks vm for your help here, using your code and a bit of googling, testing and playin about, I managed to build my first userform and incorporate into a live workbook. I was chuffed
. I had saved and closed the file, and upon re-opening, my pc crashed.
. Ever since, that file is absolutely nowhere to be seen,
disappeared off the face of the earth!! Tis not a problem, as rebuilding just provides more experience.
Where does a file just disappear to?, anyway, am sick and tired of ‘the blue screen of death’, so am gonna treat myself to a new laptop!
-
WSHansV
AskWoody LoungerJuly 2, 2008 at 9:56 am #1115469A ‘blue screen of death’ should be rare on recent versions of Windows, so if you get one frequently, there’s something seriously wrong.
When Excel crashes, it should offer to restore the file next time you start the program. But if Windows crashes, Excel may not have had the time to create the files necessary for auto-recovery.
Problems like these emphasize the importance of creating backups. You could, for example, make a copy of the workbook on a USB stick before editing it.
-
WSVegasNath
AskWoody LoungerJuly 2, 2008 at 10:16 am #1115472The blue screen of death has become my soulmate the last few months, that and his brother Freeze!! I’m running windows XP and I think that is where the major issue is. Once I have my new laptop, I plan to strip my desktop back to it’s bare bones and keep for a secondary pc. I’ve investigated all manner of different things, but never to a resolve. It may be a hardware issue, but I’ve never managed to pinpoint it.
Added later: Where did the rest of my text go?, aah s0d it, I was probably babbling anyway.
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
38 minutes ago -
KB5061768 update for Intel vPro processor
by
drmark
32 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
1 minute ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
15 hours, 49 minutes ago -
Office gets current release
by
Susan Bradley
1 hour ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 13 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
21 hours, 36 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 13 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 23 hours ago -
X Suspends Encrypted DMs
by
Alex5723
2 days, 2 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
2 days, 2 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
2 days, 2 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
2 days, 3 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 15 hours ago -
Enabling Secureboot
by
ITguy
1 day, 22 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 11 hours ago -
No more rounded corners??
by
CWBillow
2 days, 7 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 21 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 23 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
3 days, 2 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 21 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 9 hours ago -
May preview updates
by
Susan Bradley
2 days, 21 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 12 hours ago -
Just got this pop-up page while browsing
by
Alex5723
3 days, 2 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 23 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
2 days, 1 hour ago -
At last – installation of 24H2
by
Botswana12
4 days, 1 hour ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
23 hours, 5 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
4 days, 13 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.