I would like to create an array to store the name of different departments of the company. First of all, I make users to input the total amount of departments and then create a array, allowing users to key in the name of departements. But the compiler said the index of array is out of range.
Dim myarray As Variant
myarray = Array
deptnum = InputBox("Please enter the total amount of departments.")
For k = 0 To deptnum
x = InputBox("Please enter the name of department:"
x = myarray(k)
Next
redim preserveandubound. That's what you need.