List Worksheets & Chartsheets

  • Thread starter Thread starter Blue
  • Start date Start date
B

Blue

I have the following code, thanks to Jim Thomlinson, problem is it is only
picking up worksheets, I would like it to also list chartsheets as well.
Help need to change code to do this.

Private Sub Worksheet_Activate()
Dim rngToUpdate As Range
Dim wks As Worksheet

Set rngToUpdate = Range("F5")

Application.ScreenUpdating = False
For Each wks In Worksheets
rngToUpdate = wks.Name
Set rngToUpdate = rngToUpdate.Offset(1, 0)
Next wks
Application.ScreenUpdating = True

Set rngToUpdate = Nothing
End Sub


Thanks, Blue
 
Blue

Change the

Dim wks As Worksheet

to

Dim wks As Object

and change

For each wks in Worksheets

to

For each wks in Sheets

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Thanks Nick, just what I wanted.

Blue


Nick Hodge said:
Blue

Change the

Dim wks As Worksheet

to

Dim wks As Object

and change

For each wks in Worksheets

to

For each wks in Sheets

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 

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

Back
Top