Code won't work if activesheet is a Chart Sheet

B

Barry Pettis

I have an issue with an XL macro that will work only if the activesheet
is not a chartsheet. I've posted a question on the OzGrid.com ( Please
see thread at following link )

http://ozgrid.com/forum/showthread.php?t=23972&page=2&pp=10

I'm wondering if someone can explain to me why the code errors if the
active sheet is a chart sheet and will work fine if the active sheet is
a worksheet.


Regards,
Barry

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Software!
http://www.ozgrid.com/Services/excel-software-categories.htm **
 
J

Jack Schitt

Just a guess, but have you tried

Sheets(strSortThisPage)

instead of where you put

Worksheets(strSortThisPage)

?
 
P

Paulw2k

Barry,

Your activesheet is a chart-sheet and you are trying to do something that
can only be done on a worksheet.

The sheets collection is made up of worksheets, chart sheets,
Excel4MacroSheets; each with their own particular
properties and methods.

So if you know that there are chart sheets in the activeworkbook, rather
than bog standard worksheets then tailor your code
accordingly.

If TypeName(ActiveSheet) = "Chart" then .....

If TypeName(ActiveSheet) = "Worksheet" then .....


Regards

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top