accortdr
accortdr

Reputation: 91

Looping through a dynamic variable

I am trying to add data to several tables from a data set in order to categorize it for a report. In order to put all of the data in the correct category, I am trying to find a way to loop through the titles similar to this pseduocode

Sub test ()

Dim name as string, i as integer

For i = 1 to 8

name(i) = "Data"

Next i

End Sub

From a similar question I saw, it was recommended to use a dictionary, but I do not believe that will help me because I already have the data stored and sorted, I just need to put it into a presentable template to send out each week.e

Upvotes: 0

Views: 44

Answers (1)

Sam
Sam

Reputation: 5721

You have two problems in your code. Name is a reserved name and you haven't declared it as a matrix.

Sub test()
    Dim N(1 To 8) As String, i As Integer
    For i = 1 To 8
        N(i) = "Data"
    Next i
End Sub

Upvotes: 1

Related Questions