A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello and thanks for your advice. The problem noted above is in the VBA Editor before execution.
Please type
f=x^2
(and enter) without spaces in VBA editor as part of a function or subroutine. If you have a version that correctly parses the statement, it will space out and format as:
f = x ^ 2
and the statement will execute properly as in your example.
Unfortunately, if one has a VBA editor with (possibly) a different build, the statement will turn red (i.e. format error):
f=x^2
and the statement will neither space out nor execute.
I have several machines and some do parse it correctly (like yours) and some machines do not. It seems that newer machines have this problem. We are uncertain about the root of the problem.
The "workaround" is to type:
f=x ^2
that is, a space AFTER the x and then the text will be reformatted after hitting enter as:
f = x ^ 2
and the statement will be correctly parsed and interpreted. This is not intuitive (or proper) for an editor and especially not for teaching. Strange, but this problem needs attention as we have noticed it on a number of computers.