T
Taylorpk
It has been a very long time since I have programmed in Excel. I've got the
general idea, but I'm missing something.
Here's the situation:
I have a information in 2 columns A and B
In column A, if there is something, it is a Worksheet name in the workbook
In column B will be YES or NO indicating whether I should hide the worksheet
or not
Conceptually I know what to do, but I'm struggling with the right commands
and properties.
First I will not know the number of entries -- but I can assume they will
be less 150
I know I want to loop through column B, and if there is a YES, then I should
hide the worksheet that has the name in that row, column B
I thought I had it -- but I'm getting an error. I know this is very simple
sub test()
Dim Rng As Range
Dim Wksname As Worksheet
Dim i As Integer
Sheets("CONTROLLER").Select
Set Rng = Range("A3")
For Each Sheet In Rng
If Rng.Offset(i, 1).Value = "YES" Then <<<< ERROR OCCURS HERE?
Wksname = Rng.Offset(i, 0).Value
If Wksname.Visible = xlSheetVisible Then Wksname.Visible =
xlSheetHidden
End If
i = i + 1
Next Sheet
End Sub
I appreciate the hint
general idea, but I'm missing something.
Here's the situation:
I have a information in 2 columns A and B
In column A, if there is something, it is a Worksheet name in the workbook
In column B will be YES or NO indicating whether I should hide the worksheet
or not
Conceptually I know what to do, but I'm struggling with the right commands
and properties.
First I will not know the number of entries -- but I can assume they will
be less 150
I know I want to loop through column B, and if there is a YES, then I should
hide the worksheet that has the name in that row, column B
I thought I had it -- but I'm getting an error. I know this is very simple
sub test()
Dim Rng As Range
Dim Wksname As Worksheet
Dim i As Integer
Sheets("CONTROLLER").Select
Set Rng = Range("A3")
For Each Sheet In Rng
If Rng.Offset(i, 1).Value = "YES" Then <<<< ERROR OCCURS HERE?
Wksname = Rng.Offset(i, 0).Value
If Wksname.Visible = xlSheetVisible Then Wksname.Visible =
xlSheetHidden
End If
i = i + 1
Next Sheet
End Sub
I appreciate the hint