With Me statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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)
 
Are there any plans to fix this in the future?

I doubt it. VBA has remained unchanged since Excel 2000 (VBA Version 6). I
would guess that the next "upgrade" of VBA will actually be a transition to
VB.NET.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top