[VBA macro] Evaluate Value returns -4146 or 1

  • Thread starter Thread starter Jerome
  • Start date Start date
J

Jerome

Hello


I am running into a really strange problem here. I mean, I
can't figure out what's wrong.

On a worksheet I have a button (from the 'Control Toolbox'
bar, not the 'Form' bar) assigned to a macro when clicked
on.
The macro brings up a form with textboxes and other stuff.
On the form, when an 'OK' button is clicked the macro is
supposed to evaluate what's in the textbox a write it to
some cells on the worksheet.

Well that's when it becomes weird.

Depending on the value entered in the textbox, Excel
behaves strangely.
'->' means 'is evaluated as'

13 -> 1
15 -> 1
17 -> 1
19 -> 1
21 -> 1
23 -> 1
25 -> 1
27 -> 1
29 -> 1

33 -> 1
35 -> 1
37 -> -4146
39 -> 1
41 -> 1
43 -> 1
45 -> 1
47 -> 1
49 -> 1
51 -> 1
53 -> 1

72 -> 1
73 -> 1
74 -> 1
75 -> 1
76 -> 1
77 -> 1
78 -> 1
79 -> 1
80 -> 1
81 -> 1
82 -> 1
83 -> 1
84 -> -4146
85 -> 1
86 -> 1
87 -> 1
88 -> 1
89 -> 1
90 -> 1
91 -> 1
92 -> 1

I haven't been further than 100: that's weird enough.

If the textbox contains 45.0 (anything with one decimal)
then no problem.


I've checked on google for any similar cases and there are
some. But I couldn't find any acceptable (to me) answer.

I'm using Excel 2000 9.0.4402 SR1 if that helps.


Explanations or workaround would be greatly appreciated.


Thanks
Jerome
 
Got news.

Seems to be because the active worksheet contains objects
(checkboxes in this case).

See link below, it's quite well explained.
You may have to put all pieces of link together but it's
worth it.

<http://groups.google.fr/groups?hl=fr&lr=&ie=UTF-8&oe=UTF-
8&threadm=ObxMAmt6%23GA.267%
40cppssbbsa04&rnum=1&prev=/groups%3Fq%3Dexcel%2Bevaluate%
2B4146%2Bweird%26hl%3Dfr%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%
26selm%3DObxMAmt6%2523GA.267%2540cppssbbsa04%26rnum%3D1>


It fixes my problem for now but it is still a weird case.


Jerome
 
Back
Top