2: A Subroutine to call that function for each cell in range (i12:z12) that contains content that exactly matches a sheet name in ThisWorkbook
Sub SearchRange_I12toZ12(wsToSearch_ As Worksheet)
Dim rngToSearch As Range, rngX As Range
Dim wsSheet As Worksheet
Set rngToSearch = wsToSearch_.Range("I12:Z12")
For Each rngX In rngToSearch
Set wsSheet = ReturnWorksheet(rngX.Value)
If Not wsSheet Is Nothing Then
'/You now have one of many worksheets that will be operated upon, with code that sounds like simply uses...
'/...some combination of copying content, updating, or replacing operations that should be simple to do using this structure
End If
Next rngX
End Sub
Function ReturnWorksheet(strWSName_ As String) As Worksheet
Dim wsSheet As Worksheet, wsOutput As Worksheet
For Each wsSheet In ThisWorkbook.Worksheets
If wsSheet.Name = strWSName_ Then
Set wsOutput = wsSheet
Exit For
End If
Next wsSheet
Set ReturnWorksheet = wsOutput
End Function
Bookmarks