LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Force proper case on user form text box

Have used this instead - always looking for shorter code!
Had to add:
Dim v As String
to make it work though.

Thanks again
--
Traa Dy Liooar

Jock


"john" wrote:

glad it worked - on reflection, can reduce code a little this way:

Private Sub CommandButton2_Click()
Dim LastRow As Object
Dim DataStr As String
Dim na As Integer

Set LastRow = Sheet1.Range("f4000").End(xlUp)

For na = 1 To 10

v = " "

If na = 6 Then v = " v "

DataStr = DataStr & v & _
StrConv(Me.Controls("TextBox" & na).Text, _
vbProperCase)

Next na

LastRow.Offset(0, -1).Value = Trim(DataStr) 'copies text box data to
cell

For na = 1 To 10

Me.Controls("TextBox" & na).Text = ""

Next na

Me.Hide

End Sub
--
jb


"Jock" wrote:

perfect, thank very much
--
Traa Dy Liooar

Jock


"john" wrote:

see if this does what you want.

Private Sub CommandButton2_Click()
Dim LastRow As Object
Dim DataStr As String
Dim na As Integer

Set LastRow = Sheet1.Range("f4000").End(xlUp)

For na = 1 To 10

If na = 6 Then

DataStr = DataStr & " v " & StrConv(Me.Controls("TextBox" & na).Text, _
vbProperCase)

Else

DataStr = DataStr & " " & StrConv(Me.Controls("TextBox" & na).Text, _
vbProperCase)

End If

Next na

LastRow.Offset(0, -1).Value = Trim(DataStr) 'copies text box data to cell

For na = 1 To 10

Me.Controls("TextBox" & na).Text = ""

Next na

Me.Hide

End Sub
--
jb


"Jock" wrote:

Good stuff John,
How can I get a lowercase "v" to appear between the contents of text box 5
and text box 6 when they are copied to the worksheet?
--
Traa Dy Liooar

Jock


"john" wrote:

see if this does what you want:

Private Sub CommandButton2_Click()
Dim LastRow As Object
Dim DataStr As String
Dim na As Integer

Set LastRow = Sheet1.Range("f4000").End(xlUp)

For na = 1 To 10

DataStr = DataStr & " " & StrConv(Me.Controls("TextBox" & na).Text, _
vbProperCase)

Next na

LastRow.Offset(0, -1).Value = Trim(DataStr) 'copies text box data to cell

For na = 1 To 10

Me.Controls("TextBox" & na).Text = ""

Next na

Me.Hide

End Sub

--
jb


"Jock" wrote:

Hi
How can I code proper case to text boxes on a user form?
Here's the code to adapt; all text boxes to be formatted the same:

Private Sub CommandButton2_Click()
Dim LastRow As Object
Set LastRow = Sheet1.Range("f4000").End(xlUp)

LastRow.Offset(0, -1).Value = TextBox1.Text & " " & TextBox2.Text & " "
& TextBox3.Text & " " & TextBox4.Text _
& " " & TextBox5.Text & " v " & TextBox6.Text & " " & TextBox7.Text & "
" & TextBox8.Text & " " & TextBox9.Text _
& " " & TextBox10.Text 'copies text box data to cell
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""

Me.Hide
End Sub

On another user form, the date needs to be input by the user. Can an input
mask be added to a particular text box to ensure users all enter the date in
the same way?

Thanks,
--
Traa Dy Liooar

Jock

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
validation rule - force text entries to appear as Proper jennifer Excel Worksheet Functions 1 March 27th 06 03:19 AM
Correct Text Case to PROPER capitalization halljlsampeck Excel Worksheet Functions 1 February 15th 05 09:24 PM
Excel User Form- Format Proper Case dpaulos[_3_] Excel Programming 0 January 27th 04 02:36 AM
Excel User Form- Format Proper Case Dave Peterson[_3_] Excel Programming 0 January 27th 04 02:19 AM
Excel User Form- Format Proper Case dpaulos Excel Programming 0 January 27th 04 02:02 AM


All times are GMT +1. The time now is 02:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"