I have a named range compiled of 30 string values. Each of the string values is also used as the name of a sheet. I was wondering if it would be possible to loop through each string in the range to edit it's respective sheet. I've gone through some trial and error but am still stuck. Any help would be greatly appreciated.
Option Explicit
Sub NamedRanges()
Dim ws As Worksheet
Dim rng As Variant
rng = Sheets("Teams").Range("TeamList_Full")
For Each ws In rng
ws.Range("A36").Value2 = 2
Next ws
End Sub
CodePudding user response:
You can do it like this:
Sub NamedRanges()
Dim c As Range
For Each c In ThisWorkbook.Worksheets("Teams").Range("TeamList_Full").Cells
ThisWorkbook.Worksheets(c.Value).Range("A36").Value2 = 2
Next c
End Sub