View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Help with VBA Error

On Sun, 26 Feb 2012 00:54:09 +0000, HatStephens wrote:


Tonight am I attempting to learn VBA and using a tutorial from
jlathamsite.com.

It was all going well until I had to type up my first programme
(module).

The below code is producing an error which says "Expected: end of
statement" and is highlighting raiseToPower as the location.


MsgBox theNumber & " raised to the power of " raiseToPower & " = "
theResult


If it helps theNumber and raiseToPower are both Dim and are Integers.

Thanks,

Hat


You omitted an ampersand after the second quote mark. So the compiler thinks it should stop at that second quote mark, but since you have stuff on the line after that, which is not a comment, the error message is produced.

MsgBox theNumber & " raised to the power of " & raiseToPower & " = " & theResult