I am trying to make an array that dynamically holds error messages
the following code works but is not dynamic in any way:
Dim Errors(1 To 4) As String
Errors(1) = "-Customer is blank on setup sheet"
Errors(2) = "-From is blank on setup sheet"
Errors(3) = "-Attention is blank on setup sheet"
Errors(4) = "-Job Number is blank on setup sheet"
For i = LBound(Errors) To UBound(Errors)
msg = msg & Errors(i) & vbNewLine
Next i
MsgBox vbNewLine & msg, , "Missing Info"
how can i assign a variable to the variable name?
i am trying to do something like this:
num = 0
Dim Errors(1 To num) As String
I am hiding my errors inside if else statements and calling my loop at the end to display the errors. I am unable to use Dim Errors(1 to num) As String because an error is thrown saying "constant expression is required"