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?

2
  • 1
    Can you show relevant codes in your question? Edit it please. Commented Mar 19, 2018 at 1:45
  • 1
    @Raptor - FYI, code is singular in this case. Commented Mar 19, 2018 at 1:54

2 Answers 2

8

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 
Sign up to request clarification or add additional context in comments.

Comments

2

You can use Erase statement.

Erase vArray 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.