Change text to propper when populating excel from VB form

heidibbb

New Member
Joined
Dec 8, 2010
Messages
31
Hello,
Is there a way to specify in the VB code for a form to populate the excel in PROPER text instead of UPPER?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try like this

Code:
Range("A1").Value = StrConv(TextBox1.Value, vbProperCase)
 
Upvote 0
Where you have "A1", would I put the range of cells?

Range("A1:Z1").Value = StrConv(TextBox1.Value, vbProperCase)
 
Upvote 0
If you want A1:Z1 to all have the same value, yes. Otherwise you would need to loop through 26 textboxes.
 
Upvote 0
One more quesiton on this... where would this go in the syntax? Right now I have the following:

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtFirst.Value
ws.Cells(iRow, 2).Value = Me.txtLast.Value
ws.Cells(iRow, 3).Value = Me.txtTitle.Value

If Me.cb_FPS3 = True Then
ws.Cells(iRow, 11).Value = "FPS3"
Else: ws.Cells(iRow, 11).Value = ""
End If
If Me.cb_FPS3 = True Then
ws.Cells(iRow, 12).Value = "PAFC"
Else: ws.Cells(iRow, 11).Value = ""
End If
If Me.cb_FPS3 = True Then
ws.Cells(iRow, 13).Value = "NMS"
Else: ws.Cells(iRow, 11).Value = ""
End If

'clear the data
Me.txtFirst.Value = ""
Me.txtLast.Value = ""
Me.txtTitle.Value = ""
 
Upvote 0
skip that middle section... sorry that is for a different part.

The code would be

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtFirst.Value
ws.Cells(iRow, 2).Value = Me.txtLast.Value
ws.Cells(iRow, 3).Value = Me.txtTitle.Value

'clear the data
Me.txtFirst.Value = ""
Me.txtLast.Value = ""
Me.txtTitle.Value = ""
 
Upvote 0
Try like this

Code:
ws.Cells(iRow, 1).Value = StrConv(Me.txtFirst.Value, vbProperCase)
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

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