Hi, I am in need of looping macro that checks value in cells and hides columns that fit the condition, which is easy.
But now I would also need to hide specific sheet as well if the conditions are true. I can't use name, because it can be anything and can't use index, because it can be moved or other sheets added. The only option left is using codename.
So is there a way I can transform
Into code that will include variable i as well?
(Sheet5 for i=3, Sheet6 for i=4,...)
PS: I can alternatively declare them objects with numbers in the name, but that seems to be just as hard
Code:
Dim i As Integer
For i = 3 To 20
Select Case Cells(2, i)
Case 0
Columns(i).EntireColumn.Hidden = True
Case ""
Columns(i).EntireColumn.Hidden = True
Case Else
End Select
But now I would also need to hide specific sheet as well if the conditions are true. I can't use name, because it can be anything and can't use index, because it can be moved or other sheets added. The only option left is using codename.
So is there a way I can transform
Code:
Sheet5.Visible = xlHidden
Into code that will include variable i as well?
(Sheet5 for i=3, Sheet6 for i=4,...)
PS: I can alternatively declare them objects with numbers in the name, but that seems to be just as hard