Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been trying to learn and write some VBA procedures in Excel on my
hope Excel version (XP). I wish to use these on my office version (2000). They are quite simple but the 2000 acts strange in several ways that it should not, based on what I keep reading in books and the help file. First, I do not have to declare each and every variable on the XP version. If they are not declared with a DIM statement then they are established as a variant on first use. This matches what I read in all the books and the help file in both versions. Second, I try to create a carriage return in a message box by using &Chr(13). It works fine on the XP version but the 200 version says," Compile Error: Cannot find project or library." What am I missing here? Is there a setting in the 2000 versions that I should alter? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In article ,
"Shawn Shuler" wrote: First, I do not have to declare each and every variable on the XP version. If they are not declared with a DIM statement then they are established as a variant on first use. This matches what I read in all the books and the help file in both versions. You don't have to declare variables with Dim unless your modules have Option Explicit at the top. However, *especially* if you're just learning VBA, it's an *excellent* idea to put that Option Explicit in. You can do that automatically by, in the VBE, choosing Tools/Options/Editor and checking the Require variable declaration checkbox (which is probably the setting in your 2000 version). Having Option Explicit causes the compiler to catch all kinds of errors - from spelling to type mismatches, and makes the debugging process much easier Second, I try to create a carriage return in a message box by using &Chr(13). It works fine on the XP version but the 200 version says," Compile Error: Cannot find project or library." What am I missing here? Is there a setting in the 2000 versions that I should alter? I'm not sure why that would cause an error. You could try using a space between the & and the Chr(13) instead. However, I'd recommend, at least to start, that you learn the enumerated value vbNewLine instead, only because it works cross-platform (WinXL and MacXL), where Chr(13) doesn't. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I will try both of your suggestions. I appreciate the help.
"JE McGimpsey" wrote in message ... In article , "Shawn Shuler" wrote: First, I do not have to declare each and every variable on the XP version. If they are not declared with a DIM statement then they are established as a variant on first use. This matches what I read in all the books and the help file in both versions. You don't have to declare variables with Dim unless your modules have Option Explicit at the top. However, *especially* if you're just learning VBA, it's an *excellent* idea to put that Option Explicit in. You can do that automatically by, in the VBE, choosing Tools/Options/Editor and checking the Require variable declaration checkbox (which is probably the setting in your 2000 version). Having Option Explicit causes the compiler to catch all kinds of errors - from spelling to type mismatches, and makes the debugging process much easier Second, I try to create a carriage return in a message box by using &Chr(13). It works fine on the XP version but the 200 version says," Compile Error: Cannot find project or library." What am I missing here? Is there a setting in the 2000 versions that I should alter? I'm not sure why that would cause an error. You could try using a space between the & and the Chr(13) instead. However, I'd recommend, at least to start, that you learn the enumerated value vbNewLine instead, only because it works cross-platform (WinXL and MacXL), where Chr(13) doesn't. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
CELL("filename") acting Volatile? (in assoc. with PULL) | Excel Worksheet Functions | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Cell acting funny... | Excel Discussion (Misc queries) |