C
chris_j_adams
Hi,
Is there a method for hiding a sheet via the codename, when the
codename is not hard coded but derived from cells in a spreadsheet?
Eg. I would like to loop through cells which contain codenames. If
the codename is ticked, then I want to run a sub to hide that sheet,
using that codename. By way of illustration:
Set rng = Sheets("Lookups").Range("A1:A20")
For Each cell In rng
Set x = ThisWorkbook.VBProject.VBComponents(cell)
x.Visible = xlSheetHidden
Next cell
I'm not sure why this throws up error 438 at the line:
x.visible = xlSheetHidden
I've tried various permuations but can't get it to work. Many thanks in
advance if anyone kindly provides a solution.
Regards,
Chris Adams
Is there a method for hiding a sheet via the codename, when the
codename is not hard coded but derived from cells in a spreadsheet?
Eg. I would like to loop through cells which contain codenames. If
the codename is ticked, then I want to run a sub to hide that sheet,
using that codename. By way of illustration:
Set rng = Sheets("Lookups").Range("A1:A20")
For Each cell In rng
Set x = ThisWorkbook.VBProject.VBComponents(cell)
x.Visible = xlSheetHidden
Next cell
I'm not sure why this throws up error 438 at the line:
x.visible = xlSheetHidden
I've tried various permuations but can't get it to work. Many thanks in
advance if anyone kindly provides a solution.
Regards,
Chris Adams