View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Daniel Bonallack[_2_] Daniel Bonallack[_2_] is offline
external usenet poster
 
Posts: 27
Default Loop through sheets, deselect charts

My workbook has approximately 100 worksheets, and about 30
of these have charts. I would like to loop through the
sheets, and make sure that cell A1 is selected.

Sub SelectA1
For i = 1 to Sheets.count
Sheets(i).visible = True
Sheets(i).select
cells(1,1).select
Next i
End Sub

The problem is, sometimes a chart is selected, and so I
get an error if I try to select cell A1.

Can anyone improve my loop to handle the cases when a
chart is selected?

Thanks in advance
Daniel Bonallack