Welcome to the MrExcel Message Board!
First, change the declaration of the xWs
variable to be Object
instead of Worksheet
.
Then use the Application.ActiveWorkbook.Sheets
instead of Application.ActiveWorkbook.Worksheets
.
A standalone chart is not a Worksheet
, however, it is a subclass of Sheet
which is also a superclass of a Worksheet
. So, both object types will be processed in the loop when you use Application.ActiveWorkbook.Sheets
.
(I moved your question from the MrExcel Books forum to here. Please ask your future Excel questions in the Excel Questions forum, and other related questions in the corresponding question forum).