Common format for Labels in Userform
Hi,
I did the changes as requested and got some results, but
not to my expections.
i also needed a thousand seperator and force a second
decimal(0.00) incase there is only one decimal
e.g.
1234.5 to display as 1,234.50
i am using excel 2003 SR1
pls help.
Edgar
----- DennisE wrote: -----
Edgar,
I do virtually the same thing as you. The trick is
to change the label names
from whatever they are to Label001 to Label160.
Suppose the respective label captions are contained
in Sheet1 from Cell A1
through A160. In a VBA code module introduce
Sub MyLabels()
Dim ctl As Control, J As Variant
For each ctl in MyUserForm
If TypeName(ctl) = "Label" then
J = Right(ctl.Name, 3)
ctl.Caption = Sheets("Sheet1") _ .Range
("A1").Offset(J - 1).Value
ctl.Caption = _
Format(ctl.Caption, "#,##0.00")
End If
Next ctl
End Sub
-- Dennis Eisen
.
|