#1   Report Post  
Posted to microsoft.public.excel.misc
Jeff
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
printen userform problem Pierre via OfficeKB.com Excel Worksheet Functions 0 January 3rd 06 04:45 PM
Convert Worksheet to Userform Brian C Excel Discussion (Misc queries) 1 October 3rd 05 08:08 PM
Data Validation Cell - Move to UserForm thom hoyle Excel Worksheet Functions 0 April 28th 05 12:23 AM
Cell Content from UserForm Not Retained D.Parker Excel Discussion (Misc queries) 3 April 27th 05 04:56 PM
How can I run a macro in the background whilst a UserForm is visib cdb Excel Discussion (Misc queries) 3 February 10th 05 06:58 PM


All times are GMT +1. The time now is 11:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"