Couple of typos in that. The missing zero was in the other line that showed
an error and I didn't increment J, This is tested and worked fine for me
with the assumptions I stated.
Private Sub CommandButton1_Click()
Dim i As Long, j As Long
Dim v As Variant
ReDim v(0 To 0)
j = 0
For i = 1 To 5
If UserForm1.Controls("Checkbox" & i).Value Then
ReDim Preserve v(j)
v(j) = UserForm1.Controls("Label" & i).Caption
j = j + 1
End If
Next
Sheets(v).Select
End Sub
--
Regards,
Tom Ogilvy
"fragher75" wrote
in message ...
Thanx Tom,
but there's an error in your code.
I don't know very well the use of "redim" but you wrote "redim v(0 to
)".
What do I write ?
The debugger finds an error in "redim preserve v(0,j)" too.
Are you sure that it's right.
Thanx
Francesco.
--
fragher75
------------------------------------------------------------------------
fragher75's Profile:
http://www.excelforum.com/member.php...o&userid=12360
View this thread: http://www.excelforum.com/showthread...hreadid=531184