PDA

View Full Version : Solved: display multiple labels as $0.00



av8tordude
02-09-2011, 12:17 AM
Is there a simpler way to code multiple labels (see list below) to display as $0.00, instead of writing a code for each label such as...

Test1A = "$0.00"
EL2A = "$0.00"
etc.

("Test1A", "EL2A", "EL3A", "EL4A", "EL5A", "EL6A", _
"TEST7A", "DL8A", "DL9A", "DL10A", "EL5B", _
"EL6B", "TEST7B", "DL8B", "DL9B")

GTO
02-09-2011, 03:13 AM
Hi Aviator,

What type of labels?

av8tordude
02-09-2011, 06:11 AM
Hi GTO,

Their userform labels.

Tinbendr
02-09-2011, 06:24 AM
Private Sub UserForm_Initialize()
Dim MyArray As Variant
Dim A As Long

MyArray = Array("Test1A", "EL2A", "EL3A", "EL4A", "EL5A", "EL6A", _
"TEST7A", "DL8A", "DL9A", "DL10A", "EL5B", _
"EL6B", "TEST7B", "DL8B", "DL9B")

For A = 0 To UBound(MyArray)
If TypeName(Me.Controls(MyArray(A))) = "Label" Then
Me.Controls(MyArray(A)).Caption = "$0.00"
End If
Next

End Sub

David

av8tordude
02-09-2011, 06:59 AM
Thank you Tin. works perfect :friends: