When you are missing the closing element of a code structure (e.g., End If,
End Select, Loop, Until, End With, Next, etc), the compiler throws up an
error indicating that a closing element is missing but often chooses the
wrong element. For example, if you are missing an End If, the compiler may
well say there is a missing End With, even though you do in fact have and
End With.
You need to check that ALL the closing elements are present, e.g., End If
for each If and so on.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
"Capt. Bangs" wrote in message
...
I'm trying to use a block of code to validate the user's data entry in a
form. I copied the relevant portions of code that was suggested by a VBA
book that begins with a "With Me" statment and ends with and "End With"
statement. I keep getting an error message telling me that my code
includes
an "End With" statement without a "With" statement (which isn't the
case!).
I have used this code before and it worked fine. Any suggestions? Also,
I'm
not clear how the application knows that "Me" refers to the user form.
Thanks!