Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default Help with VBA Error

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

Last edited by HatStephens : February 26th 12 at 01:11 AM
  #2   Report Post  
Posted to microsoft.public.excel.newusers
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
  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 524
Default Help with VBA Error

On Sun, 26 Feb 2012 00:54:09 +0000, HatStephens wrote:
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.)

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com
Shikata ga nai...
  #4   Report Post  
Junior Member
 
Posts: 2
Default

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

I'm sure i'll be posting here regularly!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run time error 1004 general odbc error excel 2003 vba Mentos Excel Programming 5 January 24th 11 02:56 PM
Error handling error # 1004 Run-time error [email protected] Excel Programming 3 May 20th 08 02:23 PM
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM


All times are GMT +1. The time now is 09:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"