View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rich Cooper Rich Cooper is offline
external usenet poster
 
Posts: 35
Default Building/Creating an Array

I have figured out what i need with the counting the values in an array. I
use the ubound function and the lbound function substract and add 1 becasue
of a default of 0 in the array. My question to be more specific it this. I
have a workbook with 5 worksheets: Mkt1, mkt2, mkt3, mkt4, and demog. I want
to have a procedure search the worksheet tabs/names and then create an array
with the worksheets names that begin with mkt. So in the end i will have an
array of (mkt1, mkt2...)

"kkknie " wrote in message
...
This will get you started.

Code:
--------------------
Sub test()

Dim w As Worksheet

For Each w In ActiveWorkbook.Worksheets
If Left(w.Name, 3) = "MKT" Then

'Do something to populate an array

End If
Next

End Sub
--------------------

You will have to be more specific as to what you mean by populating an
array (what will it be used for, where will the data come from).

As to how to know how many items are in an array, that is difficult to
say. If you mean that you dimensioned an array like:

Dim strArray(100) as String

and want to get how many non-blanks are in it, you would just do this:

For i = 0 to 100
If strArray(i) = "" then Exit For
Next

iArrayLenght = i -1

Post back with more detail.

K


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