Simple Array question

T

Tom Walker

hi,
I have a function "HiddenItemslist" which returns an
array of items. How do I know the no of items in the
array after the function assignment?

Like this:

Dim A as variant

A = ActiveSheet.PivotTables("PivotTable1").PivotFields
("[Project].[Project Name]"). _
HiddenItemsList


"A" will have a list of items. Basically I want to
traverse thru the list to see if an item that I want is
there is not. how do I do this?

Thanks,
Tom
 
A

Alan Beban

If A is a "vertical" one-"column" list

Ubound(A)-Lbound(A)+1

will return the number of elements.

If it's a "horizontal" one-"row" list, then it depends on whether A is
one-dimensional or two-dimensional. If one

Ubound(A)-Lbound(A)+1 as above. If two-dimensional

Ubound(A,2)-lbound(A,2)+1

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top