First off, apologies for the Title - it should have read "Code cycles through. . . ", but can't see how to correct it!
Hope someone can solve this for me.
User Form has various "blocs" of Textboxes, which have different formats.
I want a Code that says for Textbox numbers a to b, do this, and for Textbox numbers x to y do something else.
I have tried three approaches and none of them work:
Code
Private Sub UserForm_Activate()
Dim i As Integer, Control As Variant
'First Approach to put Zero in boxes 3 - 145:
For Each Control In Array(Me.TextBox3, Me.TextBox145)
Set Value = 0
Set Format = Number("0.00")
Next
'Second Approach to put Zero in boxes 3 - 145:
For i = 3 To 145
Controls("Textbox" & i).Value = 0
Controls("Textbox" & i).Format = NUmber("0.00")
Next I
'Third approach to put Zero in boxes 3 - 145:
For Each Control In UserForm1.Controls
If TypeName(Control) = ("TextBox" & I) Then
IF i <146 then
Control = FormatNumber("0.00")
Control.Value = 0
End If
End if
Next
End Sub
Display More
All solutions accepted gratefully
Ochimus