Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is a pain. Are there any plans to fix this in the future?
John Chip Pearson wrote: 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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) "John" wrote in message ... This is a pain. Are there any plans to fix this in the future? John Chip Pearson wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
SUMIF statement with AND statement | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |