Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I am trying to format the textboxes on userform with the followin code, but I cannot see the problem why I cannot make it working.... For i=1 To 21 With "price0" & (i) .value=Format (.value, "£#,##0.00") End With Next i my textbox names are : price01, price02, price03...... Please assist me to make it work, Regards, gk -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi gki,
Try something like: Dim i As Long Dim ctrl As Control For Each ctrl In UserForm1.Controls If TypeOf ctrl Is MSForms.TextBox Then For i = 1 To 21 If ctrl.Name = "price0" & i Then ctrl.Value = Format(ctrl.Value, "£#,##0.00") End If Next i End If Next --- Regards, Norman "gki " wrote in message ... Hello, I am trying to format the textboxes on userform with the following code, but I cannot see the problem why I cannot make it working.... For i=1 To 21 With "price0" & (i) value=Format (.value, "£#,##0.00") End With Next i my textbox names are : price01, price02, price03...... Please assist me to make it work, Regards, gki --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
An another possibility
For i = 1 To 21 With Userform1.Controls("price0" & i) .value = Format(.Value, "£#,##0.00") End With Next i if they are named price09, price10, (rather than price010) then you would need to do For i = 1 To 21 With Userform1.Controls("price" & format(i,"00")) .value = Format(.Value, "£#,##0.00") End With Next i -- Regards, Tom Ogilvy "Norman Jones" wrote in message ... Hi gki, Try something like: Dim i As Long Dim ctrl As Control For Each ctrl In UserForm1.Controls If TypeOf ctrl Is MSForms.TextBox Then For i = 1 To 21 If ctrl.Name = "price0" & i Then ctrl.Value = Format(ctrl.Value, "£#,##0.00") End If Next i End If Next --- Regards, Norman "gki " wrote in message ... Hello, I am trying to format the textboxes on userform with the following code, but I cannot see the problem why I cannot make it working.... For i=1 To 21 With "price0" & (i) value=Format (.value, "£#,##0.00") End With Next i my textbox names are : price01, price02, price03...... Please assist me to make it work, Regards, gki --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TextBox on a userform - format to currency & percent | Excel Discussion (Misc queries) | |||
Formatting number in a UserForm TextBox | Excel Programming | |||
Formatting for Numbers & Currency in textbox | Excel Programming | |||
Userform Textbox Currency Format Problems | Excel Programming | |||
Textbox on a userform.. dispaly as currency | Excel Programming |