VB - variable name substitition - TechRepublic
General discussion
June 22, 2001 at 08:49 AM
lgonzales

VB – variable name substitition

by lgonzales . Updated 24 years, 6 months ago

I have the following code. This example is actually from VBA, but the question is a general VB one.

For x=1 to NameCounter
NameRef=”plant” + trim(str(x)) + “name”
set NameRef = Range(Cells(begindatarow,namecol),Cells(enddatarow,namecol))
Next

I need to modify this code so that the range in the Set statement is assigned to the value of the variable
NameRef and not “NameRef” literally.
For example: plant1name=Range(Cells(begindatarow,namecol),Cells(enddatarow,namecol))

This discussion is locked

All Comments