On Tue, 15 Jul 2008 08:54:31 +0100, "Bob Phillips"
I figured out the error occurs when the For Each loop tries to add
data from a text box that, as yet, has none, therefore firing the
mismatch error. The code I am attempting to write adds controls
dynamically, depending on the value of adjacent cells below several
headings. I only posted the offending code snippet.
I added:
On Error Resume Next
immediately below the For Each and it runs well now, doing exactly
what I anticipated. I'm assuming this ingores the error when there's
no data in a TextBox, and completes the routine when there is. I
really try to avoid using On Error when I don't understand why the
error occurs. I always fear it isn't doing what I intended it to do.
I did have input validation in place to prevent non numerical
characters, and added a decimal point provision to a TextBox class
routine, thanks to an ancient Rob Bovey post which detailed a class
that is implemented when the TextBox KeyPress event is triggered. I
just modified it a little for KeyDown so the backspace could be
trapped. I fussed with it for hours.
Most, in fact all the information I used, came from this group.
Thanks for your input.