Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have come across an unexpected problem. I thought that the array
asSplit() in fnFruitArray would remember its contents between calls but it does not. I must have missed something elementary here - is this really how VBA is supposed to work? Thanks, Ture Magnusson Sub Test() Dim a As Variant 'The first call works OK a = fnFruitArray MsgBox a(0) 'But the second call doesn't return an initialised array a = fnFruitArray MsgBox a(0) End Sub Function fnFruitArray() As String() Static bBeenHere As Boolean Static asSplit() As String If bBeenHere = False Then asSplit = Split("apple,orange,banana", ",") bBeenHere = True End If fnFruitArray = asSplit End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
static array | Excel Programming | |||
Load a static array at procedure level | Excel Programming | |||
Lookup from Static List/Array | Excel Worksheet Functions | |||
keeping a sum array static | Excel Worksheet Functions | |||
How to reference a public array (declared in module) from a proced | Excel Programming |