I am trying to write code that will loop through controls in a frame on a userform, find text boxes and if the text box is empty then use a function to add a specified value to an array. I then want to display a message box based on the array showing which text boxes are empty.
I have the follow Sub and Function.
My problem is that the message box displays the same text for each empty text box. For example, say I leave all 3 text boxes empty. My message box will display:
"the values of my dynamic array are:
Sample Text 3
Sample Text 3
Sample Text 3"
when what I was really looking for is:
"the values of my dynamic array are:
Sample Text 1
Sample Text 2
Sample Text 3"
I am pretty sure that the problem is that the "If" statements in the function reset the value for "WhichTB" on each subsequent encounter of an empty text box. I don't know how to pass discrete values for "WhichTB" back to the Sub and then to the array.
I hope that makes sense.
I appreciate any help.
Bookmarks