How to Handle Chart Sheets

V

vicky

i have a code where it populates all the sheet name in a combo
box .. but i get an error when any workbook has chartsheets. i need to
modify this code snippet in such a way that it has to populate even
chart sheets object name in a combo box if not atleast igonore chart
sheets object name ......

For Each wks In ActiveWorkbook.Sheets
If wks.Visible = xlSheetVisible Then
ctrl.AddItem wks.name
End If
Next wks
 
V

vicky

By Declaring Wks as Object I can certainly avoid error but chartseet
name are not populated in combooo box .
 
A

Andy Pope

Hi,

For just worksheets use,

dim wks as Worksheet

For Each wks In ActiveWorkbook.Worksheets
If wks.Visible = xlSheetVisible Then
ctrl.AddItem wks.name
End If
Next wks

Cheers
Andy
 

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