0
votes

I am writing a VBA macro to reset certain regions of a calculation workbook that I frequently use. My calculate macro hides irrelevant sheets when it runs. I want the reset macro to make all the sheets visible. So, I wrote this code:

For Each ws In ActiveWorkbook.Sheets
    ws.Visible = True
Next ws

But, when I run it, it always errors out on a specific worksheet. The exact error message is this: Error message
What am I doing wrong? The workbook does contain some "chart" worksheets. But, I am getting the error for a standard worksheet. I also don't have dim ws as Worksheet because then it cannot work with chart sheets.

1
Check if the worksheet is protected.L42

1 Answers

0
votes

Have you tried changing ActiveWorkbook.Sheets to ActiveWorkbook.Worksheets

Also might be worth checking if the workbook itself is protected.