(Solved) – How do I assign values in one array to variable in another array


I am trying to assign 1 to the variable firstCol, 2 to the variable secondCol

When I begin looping through colHeaders the looping variable Header does not take on any value. I know the syntax is incorrect and Header is being assigned num but I felt this was the best way to explain what I’m trying to do.

Is it possible to loop through variables?

Dim colHeaders() As Variant
Dim Dict As New Scripting.Dictionary
Set Dict = New Scripting.Dictionary

colHeaders = Array(firstCol, secondCol, thirdCol, fourthCol, fifthCol)

num = 1
For Each Header In colHeaders
    Header = num
    num = num   1
Next Header

Leave a Reply

Your email address will not be published. Required fields are marked *