LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a variabel to make an array?

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 ;

--
Message posted from http://www.ExcelForum.com

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
countif with variabel criteria? Hans Excel Worksheet Functions 2 January 23rd 08 06:57 AM
Make formula more simple --- array? Nikki Excel Discussion (Misc queries) 6 April 11th 07 07:21 PM
Can I make array position A(12) into a variable A(12*n) ? Paul Excel Worksheet Functions 1 October 9th 06 10:37 PM
getting the sum of variabel ranges Hein Excel Worksheet Functions 4 March 26th 06 07:44 PM
The # in my vector is absent from my array. Can I make it 0? Matherley Excel Worksheet Functions 1 July 14th 05 08:52 PM


All times are GMT +1. The time now is 01:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"