View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default Parents and looping

I think you'll have to use two separate loops

ReDim strStartDatumArray(0 To lngNumberOfCheckBoxes)

For Each ctl In Me.StartDatumRam1.Controls
If TypeName(ctl) = "TextBox" Then
strStartDatumArray(i) = ctl.Value
i = i + 1
End If
Next ctl

For Each ctl In Me.StartDatumRam2.Controls
If TypeName(ctl) = "TextBox" Then
strStartDatumArray(i) = ctl.Value
i = i + 1
End If
Next ctl


"Viktor Ygdorff" wrote:

I have a loop that worked just fine unitl I changed my userform and therefore
had to change the code. The problem with the loop is that I want it to go
through every control in two different frames. I do not know how to write
this. Thus the erronous line is:

For Each ctl In Me.StartDatumRam1.Controls & in Me.StartDatumRam2.Controls

The first part until the "&" is correct I just dont know how to write it for
two frames. please help me out! Thanks very much!

The complete loop
Private Sub startDatumTextBoxSub()
Dim i As Long
Dim ctl As Control
ReDim strStartDatumArray(0 To lngNumberOfCheckBoxes)
For Each ctl In Me.StartDatumRam1.Controls & in
Me.StartDatumRam2.Controls
If TypeName(ctl) = "TextBox" Then
strStartDatumArray(i) = ctl.Value
i = i + 1
End If
Next ctl
End Sub