dave3009
Well-known Member
- Joined
- Jun 23, 2006
- Messages
- 7,142
- Office Version
- 365
- 2021
- Platform
- Windows
- Mobile
- Web
Mornin' Folks
I need a wee bit of help please
How can I adjust this code I took from
http://processtrends.com/pg_chart_vba.htm
to simply count the total number of charts in a workbook. I don't need chart size and all that stuff just an integer returned with the total number
Cheers
Dave
I need a wee bit of help please
How can I adjust this code I took from
http://processtrends.com/pg_chart_vba.htm
to simply count the total number of charts in a workbook. I don't need chart size and all that stuff just an integer returned with the total number
Cheers
Code:
Public Sub chart_list()
Dim chtobj As ChartObject
Dim Msg As String
Dim n As Integer
n = ActiveSheet.ChartObjects.Count
Msg = "Chart List for Sheet " & vbTab & ActiveSheet.Name & vbTab & "No charts = " & n & vbCrLf & vbCrLf
Msg = Msg & "Name " & vbTab & vbTab & "Index" & vbTab & "Top Pos" & vbTab & "Left Pos " & vbTab & "Width " & vbTab & "Height" & vbCrLf
For Each chtobj In ActiveSheet.ChartObjects
cht_width = chtobj.Width
cht_height = chtobj.Height
Top_Position = chtobj.Top
Left_Position = chtobj.Left
Msg = Msg & chtobj.Name & vbTab & vbTab & chtobj.Index & vbTab & Top_Position & vbTab & Left_Position & vbTab & cht_width & vbTab & cht_height & vbCrLf
Next chtobj
out = MsgBox(Msg, , "Chart List")
End Sub
Dave