Sub CCCC()
Dim varr()
Dim i as long, j as long, res as variant
res = InputBox("Enter value for 1st element")
i = 0
Do While res <> ""
ReDim Preserve varr(0 To i)
varr(UBound(varr)) = res
i = i + 1
res = InputBox("Enter value for " & i + 1 & " element" & _
vbNewLine & " hit cancel to stop entry")
Loop
For j = LBound(varr) To UBound(varr)
Debug.Print j, varr(j)
Next
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.