ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Another stupid newbie question. (https://www.excelbanter.com/excel-programming/364301-another-stupid-newbie-question.html)

mato nanjin

Another stupid newbie question.
 
I am trying to dim some variables as public. I have this statement (among
others) in a module in the Auto_Open Sub:

"Public dtPropDate As Date ' quote date"

I get the following error message when the workbook loads:

"Compile error. Invalid atribute in Sub or function"

Any ideas why I get this?

How can I screw up something this simple?

Thanks, Ron

Bob Phillips

Another stupid newbie question.
 
It sounds as though you have declared it as part of a sub. In a sub it must
be a Dim. Public is used to declare a global variable, but it must be
declared outside of, and before, any procedures.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"mato nanjin" wrote in message
...
I am trying to dim some variables as public. I have this statement (among
others) in a module in the Auto_Open Sub:

"Public dtPropDate As Date ' quote date"

I get the following error message when the workbook loads:

"Compile error. Invalid atribute in Sub or function"

Any ideas why I get this?

How can I screw up something this simple?

Thanks, Ron




light

Another stupid newbie question.
 

mato nanjin

I a dumb newbie too but I think I may be smart enough to answer
your question. You cant use certain words that are "reserved" like
"Public" as a variable. I think the way to write this is:

Dim dtPropDate As Date


--
light
------------------------------------------------------------------------
light's Profile: http://www.excelforum.com/member.php...fo&userid=7228
View this thread: http://www.excelforum.com/showthread...hreadid=552019



All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com