Proper case from a user form text box

tony.reynolds

Board Regular
Joined
Jul 8, 2010
Messages
97
I have part of my userform code below that enters the valuse into a sheet

i need the values Company and contact to be proper case regardless of how the user enteres it.

can someone help me make it proper case when this runs or even better can it change it at the time the user enters it using the code for the Company_change ()

any help would be greatly app. :(

Code:
Private Sub Company_Change()
 
End Sub


Code:
With wb.Sheets("Sheet1")
      lr = .Range("A" & Rows.Count).End(xlUp).Row + 1
      .Range("A" & lr).Value = Company.Value
      .Range("B" & lr).Value = Contact.Value
      .Range("C" & lr).Value = Phone.Value
      .Range("D" & lr).Value = Fax.Value
      .Range("E" & lr).Value = Email.Value
      .Range("F" & lr).Value = Freight.Value
   End With
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You could try
Code:
Private Sub Company_Change()
    Company.Value = StrConv(Company.Value, vbProperCase)
End Sub
But it might be more sensible to just fix it once with this instead
Code:
Private Sub Company_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
    Company.Value = StrConv(Company.Value, vbProperCase)
End Sub
 
Upvote 0
thanks i will do when back at work tomorrow

I appreciate your help...

this forum is great and really helpfull to get better use out of office!!!!

---------------------

Aussie

Office 2010
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,619
Members
449,240
Latest member
lynnfromHGT

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