chart properties

  • Thread starter Thread starter Thrava
  • Start date Start date
T

Thrava

Hi everyone.
I have several charts in my excel sheet.
How do I find their name and properties so that I can
refer to them in vBA?
 
Thrava said:
Hi everyone.
I have several charts in my excel sheet.
How do I find their name and properties so that I can
refer to them in vBA?

Hi,

Try this:

Sub TEST()
Dim Wykres As Object, Names(1 To 20) As String, Numb As Integer, I As Integer
For Each Wykres In Worksheets("Sheet1").ChartObjects
Numb = Numb + 1
Names(Numb) = Wykres.Name
Next
For I = 1 To Numb
MsgBox Names(I)
If Worksheets("Sheet1").ChartObjects(Names(I)).Chart.HasTitle Then
MsgBox Worksheets("Sheet1").ChartObjects(Names(I)).Chart.ChartTitle.Text
End If
Next
End Sub

I hope the rest is simple for you.

Bye,

Jozef
 
thank you

-----Original Message-----
"Thrava" <[email protected]> wrote in

Hi,

Try this:

Sub TEST()
Dim Wykres As Object, Names(1 To 20) As String, Numb As Integer, I As Integer
For Each Wykres In Worksheets("Sheet1").ChartObjects
Numb = Numb + 1
Names(Numb) = Wykres.Name
Next
For I = 1 To Numb
MsgBox Names(I)
If Worksheets("Sheet1").ChartObjects(Names (I)).Chart.HasTitle Then
MsgBox Worksheets("Sheet1").ChartObjects(Names (I)).Chart.ChartTitle.Text
End If
Next
End Sub

I hope the rest is simple for you.

Bye,

Jozef
.
 
Back
Top