Preventing data entry non-conformity

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
554
UserForm adds data to my worksheet
TextBox13 is “City”
TextBox14 is “State”

If a user inputs lowercase letters into the TextBox13, can the target cell be formatted to UpperCase the first letter?

And, if lowercase letters are entered into TextBox14, how can the target cell be formatted to all UpperCase?

I’ve attempted several methods without success. For example, this line results TRUE in the target cell
Code:
ws.Cells(iRow, 19).Value = FormatCells = (UpperCase)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Convert the value when assigning it to the cell:

Code:
ws.Cells(iRow, 19).Value = UCase$(Textbox14.Text)

for example.
 
Upvote 0
RoryA,
Excellent! Thank you.

Any suggestion for capitalizing the first letter in "City"?
ws.Cells(iRow, 18).Value = ???

This would allow users to enter data without having to use the Shift key.
 
Upvote 0
You can use either StrConv:

Code:
strconv(TextBox13.Text, vbProperCase)

or the Proper worksheet function:

Code:
Application.Proper(TextBox13)
 
Upvote 0
RoryA,
Thanks for the assistance. It works beautifully.

Can you explain Application.Proper(TextBox13) worksheet function?
I'm not sure where to add this to my project.
But, since strconv works so well, I've added it for each TextBox where appropriate.
Now, users are not required to use the Shift Key for entering Names, Streets, City, etc.
That makes things work soooo much better.

Thanks, again!
 
Upvote 0

Forum statistics

Threads
1,214,390
Messages
6,119,235
Members
448,879
Latest member
VanGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top