Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chart methods in VBA
#1
Description:

Charts are objects in Excel, and they have methods like ChartType, SetSourceData, and HasTitle.

Example:

Sub ExampleChartMethods()
    'Create a new chart
    Dim cht As Chart
    Set cht = Sheets("Sheet1").ChartObjects.Add(Left:=100, Width:=375, Top:=75, Height:=225).Chart

    'Set the chart type to a column chart
    cht.ChartType = xlColumnClustered

    'Set the chart data source
    cht.SetSourceData Source:=Sheets("Sheet1").Range("A1:B5")

    'Add a chart title
    cht.HasTitle = True
    cht.ChartTitle.Text = "Sales Data"
End Sub
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a chart from data with VBA Qomplainerz 0 388 07-27-2023, 09:44 AM
Last Post: Qomplainerz
  Range methods in VBA Qomplainerz 0 318 07-27-2023, 06:29 AM
Last Post: Qomplainerz
  Worksheet methods in VBA Qomplainerz 0 296 07-26-2023, 08:44 PM
Last Post: Qomplainerz
  Objects and methods in VBA Qomplainerz 0 275 07-26-2023, 08:37 PM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 2 Guest(s)