Re: how to declare Pub Const String Array ?
- From: "Tom Ogilvy" <twogilvy@xxxxxxx>
- Date: Fri, 24 Jun 2005 13:56:32 -0400
An array isn't a constant and can't be initialized as a constant, so you
will just have to initialize the variable.
Dim C as Variant
C = Array("Jones","Smith")
or
Dim C(1 to 2) as String
C(1) = "Jones"
C(2) = "Smith"
You can make your declarations public at the top of the module outside any
procedure and use a procedure to initialize them. Then, unless you reset
the VBE, you should be able to treat them like constants.
--
Regards,
Tom Ogilvy
"***" <d_penny@xxxxxxx> wrote in message
news:1119635375.860603.173890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> can someone please show me how to declare a Public Constant String
> Array? With shortened spelling below:
>
> Pub Const C as String = "jones" works OK
> Pub Const C(2) as String = "jones","smith" does not work
>
> What to do? I would like to be able to index in an array of strings to
> get replacement values for stuff in columns H,I,J etc. by using an
> index of 18,19,20 etc.
>
> Thanks
>
.
- References:
- how to declare Pub Const String Array ?
- From: ***
- how to declare Pub Const String Array ?
- Prev by Date: "Object Variable or With Block Variable Not Set" error help request
- Next by Date: Re: working with two sheets
- Previous by thread: how to declare Pub Const String Array ?
- Next by thread: "Object Variable or With Block Variable Not Set" error help request
- Index(es):