S
SkatKat
I´ve worked up this code so far:
Sub PrintFormat()
Dim ws As Worksheet
Dim prt1 As String
Dim prt2 As String
Dim StrArray() As String
prt1 = ""
For Each ws In Worksheets
If InStr(1, ws.Name, "F") > 1 Then
prt1 = prt1 & ", " & """" & ws.Name & """"
End If
Next ws
prt1 = Mid(prt1, 3, Len(prt1))
prt2 = Mid(prt1, 2, Len(prt1) - 2)
'Worksheets("ark3").Range("A1") = prt
'"O-002F","O-003F"
Sheets(Array("O-002F", "O-003F")).Select 'this one works
Sheets(Array((prt1))).Select 'this one doesnt work
Sheets(Array(("&prt2"))).Select 'this one doesnt work
End Sub
While debugging it says "Subscript out of range" on either of th
arrays that are done over the variables prt1 and prt2, but holding th
cursor over the variables they seem to be strings with the same conten
as is in the first array. The problem is that over time a lot mor
sheets will be added, and all sheets containging the letter f must b
in the array.
I am sorry if my english is bad ;
Sub PrintFormat()
Dim ws As Worksheet
Dim prt1 As String
Dim prt2 As String
Dim StrArray() As String
prt1 = ""
For Each ws In Worksheets
If InStr(1, ws.Name, "F") > 1 Then
prt1 = prt1 & ", " & """" & ws.Name & """"
End If
Next ws
prt1 = Mid(prt1, 3, Len(prt1))
prt2 = Mid(prt1, 2, Len(prt1) - 2)
'Worksheets("ark3").Range("A1") = prt
'"O-002F","O-003F"
Sheets(Array("O-002F", "O-003F")).Select 'this one works
Sheets(Array((prt1))).Select 'this one doesnt work
Sheets(Array(("&prt2"))).Select 'this one doesnt work
End Sub
While debugging it says "Subscript out of range" on either of th
arrays that are done over the variables prt1 and prt2, but holding th
cursor over the variables they seem to be strings with the same conten
as is in the first array. The problem is that over time a lot mor
sheets will be added, and all sheets containging the letter f must b
in the array.
I am sorry if my english is bad ;