Variables Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I have to define 20 variables all of then have similar name for example :

Name13
Name14
Name15
Name16

Can I do something like "Name" & nRow = Value ?

Thank you in advance.
 
You are probably better off with an array something like this...

Sub test()
Dim strNames(1 To 20) As String

strNames(1) = "Tom"
strNames(2) = "Dick"
strNames(3) = "Harry"
End Sub
 
Why not declare an array of appropriate dimension to hold the values
instead? Then you could reference the value you needed by its index instead
of declaring 20 variables of the same type holding the same type of
information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top