Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:16:23+00:00 2026-06-15T19:16:23+00:00

I am looking to create a scatter chart that, on button press, creates a

  • 0

I am looking to create a scatter chart that, on button press, creates a scatter chart in Sheet 1 and uses A2:A11 as the x values and B2:B11 as the y values.

Using code at the bottom allows me to create a scatter chart based off of the values in A1:B3 (got this from here). Its close, but not exactly what I’m looking for. How can I tweak this to suit my needs?

I got it set up now so the chart is made, based on the values I want, but I can not get it to appear as an object in Sheet 1. How do I do this? .Location xlLocationAsObject doesn’t seem to work.

Private Sub chartButton_Click()
    ActiveWorkbook.Charts.Add
    With ActiveWorkbook.ActiveChart
        'Data?
        .ChartType = xlXYScatter
        .SeriesCollection.NewSeries
        .SeriesCollection(1).Name = "=""Scatter Chart"""
        .SeriesCollection(1).XValues = "=Sheet1!$A$2:$A$11"
        .SeriesCollection(1).Values = "=Sheet1!$B$2:$B$11"

        'Location
        'DON'T KNOW WHAT TO PUT HERE
        '.location xlLocationAsObject doesn't work!

        'Titles
        .HasTitle = True
        .ChartTitle.Characters.Text = "Scatter Chart"
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "X values"
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Y values"
        .Axes(xlCategory).HasMajorGridlines = True

        'Formatting
        .Axes(xlCategory).HasMinorGridlines = False
        .Axes(xlValue).HasMajorGridlines = True
        .Axes(xlValue).HasMinorGridlines = False
        .HasLegend = False

    End With
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:16:24+00:00Added an answer on June 15, 2026 at 7:16 pm

    Your code as written adds a chart as a Chart Sheet, not as a chart on a Worksheet

    Try this:

    Replace

    ActiveWorkbook.Charts.Add
    With ActiveWorkbook.ActiveChart
    

    with

    Dim sh As Worksheet
    Dim chrt As Chart
    
    Set sh = ActiveWorkbook.Worksheets("Sheet1")
    Set chrt = sh.Shapes.AddChart.Chart
    With chrt
    

    Then you can control its position and size with

        .ChartArea.Left
        .ChartArea.Top 
        .ChartArea.Height
        .ChartArea.Width 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to create a reg ex in JS that obtains 2 values
I'm looking to create a video using a set of png images that have
Looking to create a vertical button group that looks very similar to Twitters own
I'm looking to create a form that uses radio buttons but as soon as
I looking to create a custom calender with Zend Framework, I am hoping that
Im looking to create a control that would look like comic baloon. In WPF
I'm looking to create a portfolio using a Wordpress blog. On the summary page
I am looking to create something that resembles a table in Tkinter but it
I'm looking to create a windows program that doesn't require any environmental dependencies (like
im looking to create thumbnails that has 100px by 100px dimension. i've seen many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.