2

Now, before you say it - I've read dozens of similar topics, and couldn't find a solution. I have a dynamic Variant array, which has to be completely cleared, so it is regarded as Empty during IsEmpty check. I tried Erase, but IsEmpty still returns False. I can't ReDim it, because the array is dynamic. Tried to set whole array to Nothing, but that throws an error during IsEmpty check.

What am I doing wrong, and how can I completely eradicate that array, so the IsEmpty would return True?

J R
  • 227
  • 3
  • 8

1 Answers1

7

You can assign the keyword Empty to a Variant variable.

Public Sub Hello()

    Dim vArray As Variant

    vArray = Array("a", "b", "c")

    Debug.Print IsEmpty(vArray) 'prints false

    vArray = Empty

    Debug.Print IsEmpty(vArray) 'prints true

End Sub
andrew
  • 1,723
  • 2
  • 12
  • 24