[Solved] loop to set variables as worksheet


Or this way:

    Sub AssignWSobjectsToWorksheets()

        Dim i As Integer, n As Integer
        Dim ws() As Worksheet

        n = ThisWorkbook.Worksheets.Count

        ReDim ws(1 To n)

        For i = 1 To n
            Set ws(i) = ThisWorkbook.Worksheets(i)
        Next
    End Sub

Note that Sheets is the collection of all tabs(e.g. including charts), Worksheets just of spreadsheets

solved loop to set variables as worksheet