I'm not 100% sure which range(s) you are trying to work with in that, at one point, you limit the range to K9:K43 and, elsewhere, you go from 1 to ".rows.count".
In the context of:
With Range("Rt1!K9:K43")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
I think i will take values from 1 to 35 which, possibly, is not what you meant.
?Range("K9:K43").Rows.Count
35
Anyway, the following code will unhide the rows between K9 and K43 and then hide any rows between 1 and the last row in column K where the value of the row is 0.
Sub HideSheets()
Dim AWF As WorksheetFunction: Set AWF = WorksheetFunction
Dim i As Long
Dim SheetName As Variant
Dim myArray As Variant
myArray = Array("St1", "St2", "St3", "St4", "St5", "St6", "St7", "St8", "St9", "St10", "St11", "St12", "St13", "St14", "St15", "St16", "St17", "St18", "St19", "St20", "St21", "St22", "St23", "St24", "St25")
'myArray = Array("St1", "St2", "St3", "St4") ' for testing
Application.ScreenUpdating = False
On Error Resume Next
For Each SheetName In myArray
With Sheets(SheetName)
With .Range("K9:K43")
.EntireRow.Hidden = False
End With
For i = 1 To .Range("K" & .Rows.Count).End(xlUp).Row
If AWF.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With
Next 'SheetName
On Error GoTo 0
Application.ScreenUpdating = True
End Sub
Regards
Bookmarks