questions

I

icestationzbra

i have a couple of questions.

i have this macro which loops through all the digits in a number, cube
every digit, and adds them up.

when i was experimenting with it, i kept getting 'type mismatch' erro
for the following line - j = Len(i).

then, tried this - j = Len(Trim(i)), and the macro came throug
successfully.

how i came about using trim is, i put a msgbox right after len(i) t
know the length of string. it showed me 4 for 100. thats when i though
of using 'trim'. but i cant figure out as to why would the length be
for 100, i have defined the variable properly (not a string variable).

another question is about the accumulator macro on mcgimpsey's site
whats the utility of enableevents line in the code? if i comment tha
line, the answer is incorrect, so realise its got to be there for
reason. only, i am not able to figure out the reason.

thanks in advance for the resolutions for my queries
 
J

JulieD

Hi

if i understand your first question correctly you are using "i" is the
number you want to loop through and you want to know how many characters you
have in the number using "j"? yes? but when you use j=len(i) you get an
incorrect answer? if so, what is the line of code that populates "i"?

sorry, can't help at all on the 2nd question but please do provide more
information on the first - maybe even copy & paste the macro code into your
reply so we can see what is happening.

Cheers
JulieD
 
Top