ArrayList in Excel VBA is a class used to create an array of values. ArrayList is more flexible than native array because it's dynamic and it contains much richer functionality. It is in an external library.
Let's answer a few questions about ArrayList.
❓ 1️⃣ How to create the ArrayList ?
👉 You can create the ArrayList using early and late binding
❓ 2️⃣ How to create the ArrayList using late binding ?
👉 There is no need to activate a special library for this. All you have to do is use the simple form below:
Dim arr as Object (arr is a variable used in the video)
Set arr = CreateObject("System.Collections.ArrayList")
❓ 3️⃣ How to create the ArrayList using early binding ?
👉 To use this form, you need to perform several operations. These are those operations:
Step 1. Open the Viual Basic Editor (ALT+F11)
Step 2. Click Tools
Step 3. Click References
Step 4. Scroll down the list, tick the mscorlib.dll checkbox and click OK
After that, the following code should be written:
Dim arr as new ArrayList (arr is a variable used in the video)
❓ 4️⃣ How to remove item by name ?
👉
Dim arr as new ArrayList (early binding)
--------------------
--------------------
arr.Remove ItemName
❓ 5️⃣ How to remove item at position ?
👉
Dim arr as new ArrayList (early binding)
--------------------
--------------------
arr.RemoveAt ItemIndex
❓ 6️⃣ How to remove a range of items ?
👉
Dim arr as new ArrayList (early binding)
--------------------
--------------------
arr.RemoveRange StartingPosition, TheNumberOfItems
#excel
#msexcel
#vba
#excelvba
#microsoftexcel
#tutorial
#exceltutorial
#excelvbatutorial
#subprocedure
#vbasubprocedure
#excelvbasubprocedure
#arraylist
#vbaarraylist
#array
#arrays
#dynamic
#dynamicarray
#excelvbaarraylist
#arraylistinvba
#collection
#collections
#vbacollections
#vbatutorial
#remove
#removeat
#removerange
#item
#count
#mscorlib
#library
#dll
#tlb
#runtime
#multilanguagestandardcommonobjectruntimelibrary
#microsoftcommonobjectruntimelibrary