
Signature
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom
Please find relevant portion of code below. The code breaks on the line
reading intMaxWidth = CONST_MAX_WIDTH_MAC10¹.
> Private Const CONST_MIN_WIDTH_MAC10 As Single = 230
> Private Const CONST_MAX_WIDTH_MAC10 As Single = 582
[quoted text clipped - 53 lines]
> EBErrorHandler "frmReconciliation-cmbLineCode_Change"
> End Sub
> On 2/24/05 11:56 AM, in article BE43B7BD.2E5B%mbarton@ntlworld.com, "Mike
> Barton" <mbarton@ntlworld.com> wrote:
[quoted text clipped - 17 lines]
>
> Post the code. Then we can help.
Bob Greenblatt - 25 Feb 2005 13:25 GMT
I don¹t see anything wrong. And, it works fine for me, no error is generated
on that line, and intmaxwidth obtains the proper value. Try ³cleaning² the
vba code.
Copy ALL the code to text files. Delete the modules. Remove all the code
from the form pane(s). Save and close the workbook. Then reopen it and paste
the code back, compile and test it again.

Signature
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom
Fredrik Wahlgren - 25 Feb 2005 21:42 GMT
Re: Divide by Zero error
I don't see anything wrong. And, it works fine for me, no error is generated on that line, and intmaxwidth obtains the proper value. Try "cleaning" the vba code.
Copy ALL the code to text files. Delete the modules. Remove all the code from the form pane(s). Save and close the workbook. Then reopen it and paste the code back, compile and test it again.
--
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom
I think the file may have become corrupt. That would explain why bob doesn't get any errors. Bob's suggestion may fix the problem. I'm pretty sure there won't be a problem if you create a new file from scratch.
/Fredrik
Mike Barton - 04 Mar 2005 00:53 GMT
Bob,
I created a new add-in workbook, inserted new modules/form and copied the
code and the form controls to the new version.
I have tried this new file under both Excel X and Excel 2004. It still works
fine under Excel X and still generates the same error under Excel 2004.
If you think the corruption might be in the controls, I will re-enter the
controls rather than copying.
> I don¹t see anything wrong. And, it works fine for me, no error is generated
> on that line, and intmaxwidth obtains the proper value. Try ³cleaning² the vba
[quoted text clipped - 3 lines]
> the form pane(s). Save and close the workbook. Then reopen it and paste the
> code back, compile and test it again.
spacemodler - 25 Mar 2005 17:31 GMT
I was getting a divide by zero error at odd places after I upgraded to
2004 from X. (Do an assignment, did a comparaions of the variable just
assigned poof divide by zero error, but only while in the debigger.)
It went away after I purged all of my old microsoft preferences. I
suspect that Excel was referencing the wrong libraries for my VBA code.
I recogized this as a preferences problem, when I experimented with the
same version of excel under different accounts on my machine. New
accounts didn't have the problem, my regular account did. Cleaned
preferences problem went away.
JE McGimpsey - 25 Feb 2005 14:28 GMT
> Please find relevant portion of code below. The code breaks on the line
> reading ŒintMaxWidth = CONST_MAX_WIDTH_MAC10¹.
As Bob said, there's nothing wrong with your code at that point. It runs
fine for me using XL04. Perhaps cleaning will help.
Note that your original post said that
>> * Three different integer variables are assigned three different
>> constants (all integer values).
That parenthetical statement's not true, since you've defined your
constants as Single (floating point). That requires an implicit coercion
at assignment. It's probably not related to your problem, but it might
be relevant to the overflow statement (I'm not sure where you set your
Set Next command, so I don't know how you generated a second pass).
I rarely use anything but Long and Double for numeric variables. Using
the shorter forms doesn't save significant amounts of memory (or any, in
the case of integer vs. long), and doesn't require freqent explicit or
implicit coercions.