Consulting

Results 1 to 3 of 3

Thread: Create Chart by VBA

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Create Chart by VBA

    Need help to make a VBA program that extract data and create chart

  2. #2
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    348
    Location
    Why is this posted in "Book Reviews" forum?

    Create chart where?

    Have you done any research? Made any attempt?
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,183
    Location
    Welcome to VBAX Kamel83. The following will create a chart.

    Sub CreateChart()
    'Declare variables
    Dim rng As Range
    Dim cht As Object
    'Create a blank chart
      Set cht = ActiveSheet.Shapes.AddChart2
    'Declare the data range for the chart
      Set rng = ActiveSheet.Range("A2:B9") 'Change the range to suit your requirements
    'Add the data to the chart
      cht.Chart.SetSourceData Source:=rng
    'Set the chart type
      cht.Chart.ChartType = xlColumnClustered 'Change the Chart type to suit your requirements
    End Sub
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •