By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,841 Members | 1,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,841 IT Pros & Developers. It's quick & easy.

A97: What's a workable substitute for Dim Thing(0 to intMyCount)?

P: n/a
MLH
How can I accomplish what I'm obviously trying to
do below in a Sub procedure?

Select Case CustomerCount
Case Is < 10
Dim My_Targets(0 To 10) As String
Case Is < 50
Dim My_Targets(0 To 50) As String
Case Is < 100
Dim My_Targets(0 To 100) As String
Case Is < 200
Dim My_Targets(0 To 200) As String
Case Is < 400
Dim My_Targets(0 To 400) As String
End Select

The array declaration won't accept a variable. I don't KNOW
what the upper bound is, so I have to do a recordcount and
assign it to a variable. VBA seems to think I'm trying to Dim
the array 5 different times. Of course, I'm not. If its unclear
what I wanna do, will try to elaborate.
Oct 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ReDim Statement
Used at procedure level to reallocate storage space for dynamic array
variables.

Syntax

ReDim [Preserve] varname(subscripts) [As type] [, varname(subscripts)
[As type]] . . .

The ReDim statement syntax has these parts:
.....
straight out of the help file. You can even get to it by searching on
Dim... How 'bout that?

dim the array to whatever size (probably small) then redim it when you
know how big the array really needs to be.

Oct 11 '06 #2

P: n/a
On 11 Oct 2006 16:21:02 -0700, pi********@hotmail.com wrote:

And when you're done clean up such dynamic memory with the Erase
statement.
-Tom.
>ReDim Statement
Used at procedure level to reallocate storage space for dynamic array
variables.

Syntax

ReDim [Preserve] varname(subscripts) [As type] [, varname(subscripts)
[As type]] . . .

The ReDim statement syntax has these parts:
....
straight out of the help file. You can even get to it by searching on
Dim... How 'bout that?

dim the array to whatever size (probably small) then redim it when you
know how big the array really needs to be.
Oct 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.