View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default List Charts Macro

Hi Phil,

Try this,

Sub ListCharts()
Dim Msg As String
Dim ChtObj As ChartObject
Msg = "Worksheet: " & ActiveSheet.Name & vbCrLf
For Each ChtObj In ActiveSheet.ChartObjects
If ChtObj.Chart.HasTitle Then
Msg = Msg & vbCrLf & ChtObj.Name & " " &
ChtObj.Chart.ChartTitle.Text
Else
Msg = Msg & vbCrLf & ChtObj.Name
End If
Next
MsgBox Msg
End Sub

Cheers
Andy

Phil Hageman wrote:

This sub creates a message box listing worksheet charts, by chart number. Can the code be modified to show the chart title after the chart name?

Sub ListCharts()
Dim Msg As String
Dim ChtObj As ChartObject
Msg = "Worksheet: " & ActiveSheet.Name & vbCrLf
For Each ChtObj In ActiveSheet.ChartObjects
Msg = Msg & vbCrLf & ChtObj.Name
Next
MsgBox Msg
End Sub


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info