error 16 (expression too complex) in plain English

P

PatFinegan

I have a public date variable that's retrieved from a worksheet cell and
"rounded" to the last day of the month in which it resides. This takes
just one small line of code. There are no other manipulations of the
variable, although it is referenced frequently without incident in
multiple procedures spanning thousands of lines of code.

The expression somehow causes an error 16 ("expression too complex")
when I compare that variable to another date variable in just one
procedure. Strangely, the expression is OK if, after receiving the
error, I click Debug and then Continue. But if I add a breakpoint where
the code crashes, I see that the variable is indeed flagged "expression
too complex", and I have to put an Error/Resume routine in in order to
get past this point automatically.

I can of course insert such an Error/Resume handler or re-populate the
variable from the worksheet, but I'd like to know why I'm encountering
a problem in the first place. Any thoughts? Thanks in advance.
 
F

Frank Kabel

Hi
it would be easier to give you some ideas if you post the specific code
part which causes the error :)
 
P

PatFinegan

Guten Tag, Frank. Als ich schrieb, das Problem verschwindet sich wen
ich 5 kurze Zeilen von Code hinzufügen:

On Error Goto ErrorHandler

. . .

ErrorHandler:
Select Case Err
Case 16
Resume
EndSelect

Meine Frage war deshalb konzeptionell, d.h. wie ist es möglich, das
eine Größe die "zu kompliziert" zu begreifen ist, plötzlich nach eine
"Resume" Befehl OK ist? Gewiss könnte ich das ganze Programm als Anlag
einfügen, aber das wäre nicht praktisch, weil ich eine einfache Lösun
schon habe. Stattdessen suche ich nach einer Erklärung, warum eine "z
komplizierte" Größe plötzlich OK sein könnte, nach nur einem "Resume
Befehl
 
F

Frank Kabel

Hi
though German is my native language it would be better to post in
English in this NG or we should transfer this issue to the German Excel
NG :)
To give you an explanation why this error occurs I/we at least need the
specific lines (not the total macro) which throws the error message.
Otherwise you'll get only 'expert guesses'
 

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

Top