Hi All,
I have more than 50 textboxes on my userform but i need to format them to number as 0.00. Is there any way to do all 50 boxes at once rather than 1 line of code per box?
Any help would be great.
Thanks,
Si
Hi All,
I have more than 50 textboxes on my userform but i need to format them to number as 0.00. Is there any way to do all 50 boxes at once rather than 1 line of code per box?
Any help would be great.
Thanks,
Si
Last edited by badeye; 04-01-2010 at 09:18 AM.
Hi,
HTHPlease Login or Register to view this content.
Can't get it working, What am i doin wrong?
Code:
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To 5
Me.Controls("TextBox" & i).Value = Format(Me.Controls("TextBox" & i).Value, "0.00")
Next i
Me.TextBox1.Value = Range("A2")
Me.TextBox2.Value = Range("B2")
Me.TextBox3.Value = Range("C2")
Me.TextBox4.Value = Range("D2")
Me.TextBox5.Value = Range("E2")
End Sub
Hi,
HTHPlease Login or Register to view this content.
Hi,
The formatting still isnt working, please see the attached form.
Please note: the attached for is just me testing the code and not the actual form it will be used on as the actual form is too big to upload onto here.
I'm just learning this stuff myself but shouldn't the formatting happen AFTER the values come in. In other words have:
Please Login or Register to view this content.
Hi,
In the end i did this and it worked.
"
Private Sub CommandButton1_Click()
Dim i As Integer
Me.TextBox1.Value = Range("A2")
Me.TextBox2.Value = Range("B2")
Me.TextBox3.Value = Range("C2")
Me.TextBox4.Value = Range("D2")
Me.TextBox5.Value = Range("E2")
For i = 1 To 5
Me.Controls("TextBox" & i) = Format(Me.Controls("TextBox" & i).Value, "0.00")
Next i
End Sub
"
Thanks,
Si
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks