Hi there Everyone. My problem probaly it is very easy for some of you but for me its really annoying and makes me go crazy. I just started learning VBA from a book. The title of the book is: "Excel 2003 power programming with VBA" and the author is John Walkenbach. My excel is version 2000, Hungarian version but when I switch to Visual Basic it is English (Visual Basic is always English, right?). So the very first macro in this book is a very basic and simple macro, however I get an error message saying: "Syntax error".
The macro looks like this:
The syntax error message I get is referring to the row: MsgBox “The answer is “ & SumCode:Sub Test() Sum = 1 + 1 MsgBox “The answer is “ & Sum End Sub
Could someone please help me, because I am really frustrated that this is the very first and very basic (I just copy and paste) code and I am already stucked with it, because of this error message. What am I doing wrong? What is wrong?
Thank you in advance for your help!
Last edited by hunsnowboarder; 07-16-2008 at 04:23 AM. Reason: Wrong format
Hi hunsnowboarder,
VBA can be really frustrating when you first start.![]()
The problem with your code is the “ characters around the words “The answer is.“
If you change them to the more 'vertical version' like this: " then your code will be fine provided that there is no Option Explicit statement at the top of your code module.
This is what your procedure should look like:
ColinCode:Sub Test() Sum = 1 + 1 MsgBox "The answer is " & Sum End Sub
Thanx a lot colin_l!!!![]()
![]()
Now it works!! You cannot imagine how sad and desperate I was that my very first (copy and paste) code did not work!
Thank you again!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks