Overcoming issues with vbProperCase

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
554
So that Users do not have to capitalize the entries made into UserForm TextBoxes, I’ve incorporated these lines of code.
Rich (BB code):
ws.Cells(iRow, 1) = StrConv(TextBox1.Text, vbProperCase)
ws.Cells(iRow, 2) = StrConv(TextBox2.Text, vbProperCase)
ws.Cells(iRow, 3) = StrConv(TextBox2.Text, vbProperCase) & " " & StrConv(TextBox1.Text, vbProperCase

However, this creates a problem…because surnames such as McDonald and LaDeaue become Mcdonald and Ladeaue in the destination database.

I use a 3rd-party application (where the names are properly capitalized) to build an event attendee list. My code then adds data from the database to the attendee list. The differences in capitalization are causing “Type mismatch” errors in this process:
Rich (BB code):
For Each Cl In wsAttendees.Range("A2", wsAttendees.Range("A" & Rows.Count).End(xlUp))
         sKey = Trim(Cl.Value)
        
If .Item(sKey)(2) = "" Then

I’m inclined to eliminate the vbProperCase coding but, I’m wondering if there might be another solution?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Just a comment, that I would not use ProperCase where names are involved. Especially if the owners of the names will be viewing them.
 
Upvote 0
How does the third party handle a name like "k.d. lang"?

Names either have to be dealt with by hand, or, if automatically, by users who realize that the capitalization is going to be off sometimes.
 
Upvote 0
Thanks for confirming my suspicions.
Fortunately, "k.d. lang", "50 Cent", or even "Big Lar" are names that aren't associated with my project!:LOL:
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,576
Members
449,174
Latest member
chandan4057

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