Hello,
I am trying to get some code to work where it loops through specific worksheets specified on worksheet CaseList and for each worksheet, it loops through all the rows starting with B13 until it is empty. When i run the code below, it goes to the first worksheet in the list, loops through the rows but does not advance to the next worksheet. it appears, when screen updating is on, that it loops through all of the rows on the first worksheet the same number of times as the number of worksheets that is listed in Caselist. I am sure it is something pretty simple, but i am new to nested loops. Thanks in advance.
The only reason I am doing this is to activate a private sub to run code that resizes merged cells, which the only thing that doesn't work is advancing to the next sheet in the list.
I am trying to get some code to work where it loops through specific worksheets specified on worksheet CaseList and for each worksheet, it loops through all the rows starting with B13 until it is empty. When i run the code below, it goes to the first worksheet in the list, loops through the rows but does not advance to the next worksheet. it appears, when screen updating is on, that it loops through all of the rows on the first worksheet the same number of times as the number of worksheets that is listed in Caselist. I am sure it is something pretty simple, but i am new to nested loops. Thanks in advance.
The only reason I am doing this is to activate a private sub to run code that resizes merged cells, which the only thing that doesn't work is advancing to the next sheet in the list.
VBA Code:
Dim x As Integer
Dim Sht As Worksheet
Dim sheet_names As Variant
Set sheet_names = ThisWorkbook.Sheets("CaseList").Range("C2:C2000")
For Each Sht In ThisWorkbook.Sheets
If Not IsError(Application.Match(Sht.Name, sheet_names, 0)) Then
Range("B13").Select
Do Until IsEmpty(ActiveCell) And IsEmpty(ActiveCell.Offset(-1, 0))
ActiveCell.Value = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
End If
Next Sht