ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variables Name (https://www.excelbanter.com/excel-programming/400378-variables-name.html)

Angeles

Variables Name
 
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.


Jim Thomlinson

Variables Name
 
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

--
HTH...

Jim Thomlinson


"Angeles" wrote:

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.


Edmund

Variables Name
 
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.

"Angeles" wrote in message
...
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.





All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com