View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
lcaretto lcaretto is offline
external usenet poster
 
Posts: 9
Default Setting an array of text boxes equal to individual form text b

Nigel - thanks for your answer. First of all, I should have noted that I am
using a user form so I only needed your first solution.

I adopted your answer to my approach of getting an array of references using
the statement textBoxArray(index) = Controls(txtIndexName), where
txtIndexName is the name given to the text box in the properties window.

Your answer made me question my approach. Perhaps I should just use an
array of values, as implied in your answer, instead of an array of
references.

"Nigel" wrote:

You could use the Controls collection if on a UserForm or OLEObjects
collection if controls are on the worksheet, the value can then be passed to
your checkInput routine.

For i = 1 To 4
Controls("TextBox" & i).Value
Next i

For i = 1 To 4
ActiveSheet.OLEObjects("TextBox" & i).Value
Next i

--

Regards,
Nigel