![]() |
Userform
Hi,
I have a userform with textboxes and I want to enter numbers into the boxes and then put the numbers into an array (so I have an "OK" box in the userform that loads the numbers). What I have done is simply write in the "OK" box code module thing is Array(1)=TextBox1.value Array(2)=TextBox2.Value ..... For 35 array values. (if anyone knows a faster way to do this please share). But the problem was that if the TextBox1.Value does not have an input it has a "" value. And the array is not assigned anything. If there is a "" I want the array to be equal to zero. Is there an easy way to do this without doing an if loop for each TextBox1.value, since there are 35. At the end of the code the array takes the previous arrays value if the textbox is empty, because I do not want a person to have to input every single number into the userform. It will automatically load the last value. So I wrote this: If PremArray(1) = 0 Then MsgBox "You must enter a value in year 1" End If For i = 2 To 100 If PremArray(i) = 0 Then PremArray(i) = PremArray(i - 1) End If Next i Any advice would be greatly appreciated |
All times are GMT +1. The time now is 10:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com