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 9015853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:51:14+00:00 2026-06-16T03:51:14+00:00

How do I make a graph fill a specific range? I found out how

  • 0

How do I make a graph fill a specific range? I found out how to do it using VBA a while ago, but I can’t for the life of me find out how to do it again. I’d like a graph to fill a specific range, like F1 to K8. That way if the other columns to the left change due to user input, the graph while still stay in that range, making everything look nice.

My second questions is, how do I change the size of the markers on an excel graph using VBA? I’m plotting thousands of data points, and the default markers are huge diamonds, so the graph looks ridiculous with thousands of these. The line is just this incredibly thick thing.

And one extra bonus question! I’m making the entire graph using VBA. There are two series I’m making. However, when inserting the two series, it adds a third series with no data points in it. It wouldn’t be annoying if it didn’t show up in the legend. How do I delete a series?

Thank you! Here is the relevant code. Counter and NewTracker are variables that are based on user input. I believe Counter = 13 and NewTracker = 1202 for the data I’m using, but I don’t think it matters based on my questions here! Just replace the ranges with something nicer if you feel like using an example. 🙂

Sub Makingthechart()
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ChartType = xlXYScatter
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).Name = "=Sheet1!$B$1"
    ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$A$2:$A$" & Counter + 1
    ActiveChart.SeriesCollection(1).Values = "=Sheet1!$B$2:$B$" & Counter + 1
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(2).Name = "CFL Calculated"
    ActiveChart.SeriesCollection(2).XValues = "=Sheet1!$XFB$1:$XFB$" & NewTracker
    ActiveChart.SeriesCollection(2).Values = "=Sheet1!$XFC$1:$XFC$" & NewTracker
    With ActiveWorkbook.ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.Text = "CFL Over Time"
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time (Days)"
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "CFL"
        .Axes(xlCategory).HasMajorGridlines = True
        .Axes(xlCategory).HasMinorGridlines = True
    End With
End Sub

I seriously appreciate all of your help! You guys are the reason I’ve been pretty successful in my internship so far! I can’t believe you guys know all these tiny things about VBA that I can’t even find via Google.

  • 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-16T03:51:15+00:00Added an answer on June 16, 2026 at 3:51 am
    Sub Makingthechart()
        Dim co As Shape, cht As Chart
        Dim rngChart As Range, sc As SeriesCollection
    
        Set rngChart = ActiveSheet.Range("F2:J15")
    
    
        Set co = ActiveSheet.Shapes.AddChart(xlXYScatter, rngChart.Cells(1).Left, _
                                              rngChart.Cells(1).Top, _
                                              rngChart.Width, rngChart.Height)
    
        Set cht = co.Chart
        Set sc = cht.SeriesCollection
    
        'remove any default series
        Do While sc.Count > 0
            sc(1).Delete
        Loop
    
        With sc.NewSeries
            .Name = "=Sheet1!$B$1"
            .XValues = "=Sheet1!$A$2:$A$" & counter + 1
            .Values = "=Sheet1!$B$2:$B$" & counter + 1
            .MarkerSize = 3
        End With
    
        With sc.NewSeries
            .Name = "CFL Calculated"
            .XValues = "=Sheet1!$XFB$1:$XFB$" & newtracker
            .Values = "=Sheet1!$XFC$1:$XFC$" & newtracker
            .MarkerSize = 3
        End With
    
        With cht
            .HasTitle = True
            .ChartTitle.Characters.Text = "CFL Over Time"
            .Axes(xlCategory, xlPrimary).HasTitle = True
            .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time (Days)"
            .Axes(xlValue, xlPrimary).HasTitle = True
            .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "CFL"
            .Axes(xlCategory).HasMajorGridlines = True
            .Axes(xlCategory).HasMinorGridlines = True
        End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make graph control in WP7 Mango, but can't find anything suitable
I want to be able to make a line graph using GTK+ but I'm
How do I make this graph using javascript? What library can handle this (canvas/svg)?
Ok I am using Flotr2 to make a graph, and apparently the only way
I'm trying to make a force directed graph using d3.layout.force , and I need
I want to make a graph of several ROC curves in WPF. I've found
I want to make interactive graph like this using Qt and C++ : http://jsxgraph.uni-bayreuth.de/wiki/index.php/Cubic_spline_interpolation
I am trying to make an interactive graph out of an svg with paths
I am trying to use the node-facebook-sdk to make FB graph API calls using
I'm trying to make a graph in GUI but I really don't understand how

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.