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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:49:27+00:00 2026-06-09T09:49:27+00:00

This is really two separate questions. First, I have an excel sheet with three

  • 0

This is really two separate questions. First, I have an excel sheet with three columns of data. I have 12 rows of data in columns A, C, and E. From what I’ve been looking up, This program should assign column A to the x-axis, and Columns C and D to the y-axis, while also adding labels.

Sub ChartMaker()
    ActiveWorkbook.Charts.Add
    With ActiveWorkbook.ActiveChart
        .ChartType = xlXYScatterLines
        ActiveChart.SetSourceData Source:=Range("A1:A12,C1:C12,E1:E12")
        .Location xlLocationAsNewSheet
        .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 = False
        .Axes(xlValue).HasMajorGridlines = True
        .Axes(xlValue).HasMinorGridlines = False
        .HasLegend = False
    End With
End Sub

I keep getting the error “Object variable or With block variable not set”.

That’s my first question!

My second question is how can I create a graph with the following sets of data, where there are two sets of data on the y-axis, but they share an x-axis.

Data set one:

X     Y1

1    0.87
2    0.45
3    0.92
4    0.03
5    0.99
6    0.45
7    0.63
8    0.83
9    0.28
10   0.66

Data set two:

X      Y2

0.3    2
4.5    3
6      6
7.2    1
7.8    6
8.3    1 
9.1    4
9.6    5
10     9
13     2

Is there a way to get these on the same graph? (Using VBA of course)

  • 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-09T09:49:28+00:00Added an answer on June 9, 2026 at 9:49 am

    After creating the chart

    ActiveSheet.Shapes.AddChart.Select  
    'this adds the chart and selects it in the same statement
    ActiveChart.ChartType = xlXYScatter
    

    you then add the first set of points

    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).Name = "=Sheet1!$C$1"
    ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$A$3:$A$12"
    ActiveChart.SeriesCollection(1).Values = "=Sheet1!$C$3:$C$12"
    

    and use the same method to add the second set

    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(2).Name = "Sheet1!$E$1"
    ActiveChart.SeriesCollection(2).XValues = "=Sheet1!$D$3:$D$12"
    ActiveChart.SeriesCollection(2).Values = "=Sheet1!$E$3:$E$12"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is really two questions: Why isn't the membership operator (__contains__) ever being called?
This consists of two questions: Is MySQL's timestamp field really faster than datetime field
I'm really struggling with this now, been on it for ages and asked two
I am having a really hard time getting this to work. I have two
I'm really new to JavaScript and jQuery. My question is this. I have two
This is sort of two coding style questions in one. I have a tab-dl'd
This is really a two part question: I'm seeing some users in the Grantee
java.util.concurrent.ConcurrentLinkedQueue comes to mind, but is it really optimum for this two-thread scenario? I
I've been struggling with this problem for two weeks now. I've searched all over
I have a method that transfers data from one database to another and in

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.