Help with VBA Error

H

HatStephens

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

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

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

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

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

Thanks

Ha
 
R

Ron Rosenfeld

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
 
S

Stan Brown

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

You forgot the ampersand before theResult.

(I'm assuming in the original this was all on one line.)
 
H

HatStephens

Thank you both so much!! I'm starting to get the hang of this.....well
little!

I'm sure i'll be posting here regularly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top