Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
printen userform problem | Excel Worksheet Functions | |||
Convert Worksheet to Userform | Excel Discussion (Misc queries) | |||
Data Validation Cell - Move to UserForm | Excel Worksheet Functions | |||
Cell Content from UserForm Not Retained | Excel Discussion (Misc queries) | |||
How can I run a macro in the background whilst a UserForm is visib | Excel Discussion (Misc queries) |