Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 44
Default Array questions

Hi

Working with arrays i a lot faster than worksheet functions (I suppose
so...). I have a few questions about arrays.

1st question
Is it possible to assign a value to multiple elements of an array: I'd like
to do something like that:

a(1 to 10) = 0

2nd question:
Is it possible to get this faster, without loops:

For i = 1 To UBound(a)
If a(i) = strValue Then
Matches = aMatches + 1
End If
Next i

3rd question:
Is it possible to use worksheets functions with arrays, something like that:

matches = Application.CountIf("abc", aValues, 0)


Maybe there is a tuturial available how to work with arrays most efficient.

Tom


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Array questions

1) No, you cannot do that
2) Using a loop is the normal way to do that, and it's the most efficient and easy to debug
3) I don't know a way to do that in the case you described


----- Tom wrote: ----

H

Working with arrays i a lot faster than worksheet functions (I suppos
so...). I have a few questions about arrays

1st questio
Is it possible to assign a value to multiple elements of an array: I'd lik
to do something like that

a(1 to 10) =

2nd question
Is it possible to get this faster, without loops

For i = 1 To UBound(a
If a(i) = strValue The
Matches = aMatches +
End I
Next

3rd question
Is it possible to use worksheets functions with arrays, something like that

matches = Application.CountIf("abc", aValues, 0


Maybe there is a tuturial available how to work with arrays most efficient

To

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Array questions

Hi Tom

1st question

One way:

Sub Test()
'Leo Heuser, 25 Nov. 2003
Dim Arr As Variant

Arr = [(Row(1:10)^0)*5]

Arr = Application.WorksheetFunction.Transpose(Arr)

End Sub


Arr = [(Row(1:10)^0)*5]

creates a 2-dimensional 1-based array
Arr(1,1) to Arr(10,1) filled with 5's

Arr = Application.WorksheetFunction.Transpose(Ar)

transposes it to a 1-dimensional 1-based array
Arr(1) to Arr(10)

In Excel 97 and 2000 using Transpose as shown
there is a limit around 5400 elements. This limitation
doesn't exist in Excel 2002 and on.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Tom" skrev i en meddelelse
...
Hi

Working with arrays i a lot faster than worksheet functions (I suppose
so...). I have a few questions about arrays.

1st question
Is it possible to assign a value to multiple elements of an array: I'd

like
to do something like that:

a(1 to 10) = 0

2nd question:
Is it possible to get this faster, without loops:

For i = 1 To UBound(a)
If a(i) = strValue Then
Matches = aMatches + 1
End If
Next i

3rd question:
Is it possible to use worksheets functions with arrays, something like

that:

matches = Application.CountIf("abc", aValues, 0)


Maybe there is a tuturial available how to work with arrays most

efficient.

Tom




Reply
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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
Excel CHALLENGE...3 questions(indirect,rank,array formula)... Mlowry Excel Worksheet Functions 8 August 1st 05 07:34 AM
Array Functions - Two Questions MDW Excel Worksheet Functions 3 January 12th 05 06:54 PM
Listbox and Array questions Stuart[_5_] Excel Programming 4 September 23rd 03 11:04 PM
Array Questions DWTSG Excel Programming 3 July 24th 03 06:53 PM


All times are GMT +1. The time now is 01:58 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"