View Single Post
Old 12-07-2017, 01:10 PM   #6
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 12,178
Thanks: 58
Thanked 1,127 Times in 1,029 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Declaring adn defininf public variables

Quote:
Public StrTier1, StrTier11 As String
Two things are wrong with what you posted vs. what you later said you needed.

1. Syntax: This should be

Code:
Public StrTier1 As String, StrTier11  As String
As you had it written, StrTier1 was a Variant. You can STILL assign a string value to it and it will work just fine - but it is VERY SLIGHTLY less efficient if your intent is that it would ALWAYS be a string and NEVER anything else. I suspect that the difference would only be detectable by timing two loops, each with an iteration count of 1,000,000 or so and each using one of the two definitions.

2. Semantics: Make it

Code:
Private StrTier1 As String, StrTier11  As String
(Or instead of Private you could use Dim, since Private is the default, I think.)

And as you have already acknowledged, this declaration must be in the declaration area of the module to be visible to the rest of the module.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote