Can any controls name concatenated?
If you know the names and the number of textboxes:
Option Explicit
Private Sub UserForm_Initialize()
Dim iCtr As Long
For iCtr = 1 To 10
Me.Controls("Txtbox" & iCtr).Value = "all the same"
Next iCtr
End Sub
Richard wrote:
Hi,
Hope someone can help me with this.
Here is the Example that I'm trying to do.
Example
assume there is the text box controls such as txtbox1, txtbox2, txtbox3,
txtbox4, txtbox5, etc...
Private Sub UserForm_Initialize()
Dim ctrTextbox As Controls
For i = 1 To 10
ctrTextbox = "txtbox" & i
Me.ctrTextbox = "All text box have same value"
Next i
End Sub
With above coding, I'm getting Complie error: "Argument not optional"
Any help will be appreciated.
Thanks
--
Dave Peterson
|