ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to use a cell value as the base for the name of a variable (https://www.excelbanter.com/excel-programming/340265-how-use-cell-value-base-name-variable.html)

Ian B

how to use a cell value as the base for the name of a variable
 
I have a list of names stored in a worksheet and I want to use these to
define a set of variables.

I there anyway to do this

I tried this

Dim Sheets("names").Cells(1,1).Value As String

but with no luck

Ian B

Norman Jones

how to use a cell value as the base for the name of a variable
 
Hi Ian,

Perhaps you could do something like:

Sub Test()
Dim arrNames As Variant

arrNames = Range("A1:A20")

For i = LBound(arrNames) To UBound(arrNames)
Debug.Print arrNames(i)
Next i

End Sub


---
Regards,
Norman



"Ian B" wrote in message
...
I have a list of names stored in a worksheet and I want to use these to
define a set of variables.

I there anyway to do this

I tried this

Dim Sheets("names").Cells(1,1).Value As String

but with no luck

Ian B





All times are GMT +1. The time now is 03:34 PM.

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