-
January 27th, 2014, 08:24 PM
#1
Help with code compile error message.
Hi all,
I am very new to programming and VBA so absolutely any help is greatly appreciated. I am trying to fix this code and I cannot find where the error is. Whenever I try to run it, I get a message saying "Compile error: Variable not defined"
Option Explicit
Sub ChipmunkToss()
Dim Dale As Single, Theo as Single
Dale = 11.1
Theo = 31.3
MsgBox Dale1 + Theo1
End Sub
Thank you in advance for any help!
-
January 27th, 2014, 08:52 PM
#2
Re: Help with code compile error message.
Single means WHOLE # ONLY. No decimal points. Try 11 + 31 instead
-
January 29th, 2014, 01:15 PM
#3
Re: Help with code compile error message.
![Quote](images/misc/quote_icon.png) Originally Posted by dglienna
Single means WHOLE # ONLY. No decimal points. Try 11 + 31 instead
What?
Single means Single Precision and has decimals
The problem here is that @AndrewDz is declaring Dale and Theo but he is using Dale1 and Theo1 in the MsgBox
Last edited by jggtz; January 29th, 2014 at 01:43 PM.
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
January 30th, 2014, 12:29 AM
#4
Re: Help with code compile error message.
oops. was thinking INT for Integer
-
February 1st, 2014, 01:57 AM
#5
Re: Help with code compile error message.
Your problem is highlighted in Red
Code:
Option Explicit
Sub ChipmunkToss()
Dim Dale As Single, Theo as Single
Dale = 11.1
Theo = 31.3
MsgBox Dale1 + Theo1
End Sub
Dale1 and Theo1 do not exist
Edit: I see that jggtz pointed this out above also
Always use [code][/code] tags when posting code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|