I have 10 UserForm Controls with Names Account1 to Account10 that are defaulted as Visible = False. I am trying to create a Function to unhide the Controls in ascending numeric order.
Private Sub AddButton_Click()
Select Case CountTextBox.Value
Case 1
Account1.Visible = True
Case 2
Account2.Visible = True
Case 3
Account3.Visible = True
Case 4
Account4.Visible = True
Case 5
Account5.Visible = True
Case 6
Account6.Visible = True
Case 7
Account7.Visible = True
Case 8
Account8.Visible = True
Case 9
Account9.Visible = True
Case 10
Account10.Visible = True
End Select
End Sub
How can I simplify this VBA code?
Me.Controls("Account" & number).Visible = True