1st i explain what i'm trying to do. I have a workbook with many sheets and each of them have many named ranges. I want to loop through named ranges on a specific sheet and then hide/unhide them, if it has a specific name. At start i want to isolate the sheet and there i have the problem. I'm trying to get the name of the sheet, the range is on and assign that name to a variable. Here is the part of the code, i'm having problems with:
Dim rng as Name
Dim shP as String
for each rng in ThisWorkbook.Names
shp = rng.RefersToRange.Parent.Name 'here i get the error
... rest of the code ...
If i just Debug.Print rng.RefersToRange.Parent.Name instead in that line, i get the sheet name printed out in immediate window.
I also tried to Dim shP as Variant but it didn't helped.
Thank you in advance for your answers.
