Balint Kiss
Balint Kiss

Reputation: 1

Error in vba when square with ^2

I use VBA in Excel 2013. Before I switched to this new version I generally used the form below to get a number's square:

k = o ^ 2

Now when I use this I get an error message "compile error, expected: end of statement".
How can I fix it? I would like to use the old expression.

Upvotes: 0

Views: 6952

Answers (1)

kojow7
kojow7

Reputation: 11414

It is not this line giving you the error. Check the lines prior to this one to see if they are correct. Generally this error means you forgot to close something such as a quote or a bracket.

Also, double check that your actual code has spaces around the ^ operator.

Upvotes: 2

Related Questions