my array size is decided by the some other function. but when i tried to define the size of the array using the variable i am getting the error "Constant Expression Required"
i would like define the size of the array
Option Explicit
Sub Abcd()
Dim n_variables As Integer
n_variables = def()
MsgBox "n_variables" & n_variables
Dim abc(1 To n_variables) As Integer
End Sub
Function def()
def = 100
End Function
is there any way i can define the array size in variable format? Any one help me please.
答案 0 :(得分:2)
Dim n_variables As Integer
n_variables = def()
MsgBox "n_variables" & n_variables
Dim abc() As Integer
Redim abc(1 To n_variables) As Integer