vba - subscript out of range when increasing array size -
im creating userform gets many inputs possible in array. every time new value entered array made bigger when getting second input subscript out of range
sub getflow() thisflow = userform4.textbox1.value if val(thisflow) >= 0 if isinitiated = true redim preserve flows(1 ubound(flows) + 1) else redim flows(1) isinitiated = true check = true end if flows(ubound(flows)) = thisflow userform4.textbox1 = "" userform4.textbox1 .setfocus .selstart = 0 .sellength = len(.text) end else msgbox "value should equal or greater zero!" end if exit loop
you cant specify lower bound when redim - need specify new upper bound.
redim preserve flows(ubound(flows) + 1)
Comments
Post a Comment