Name for excel graph problem with the vba generator

0 votes

So I'm attempting to create a graph chart using a name as a range of data. I generated a code using Excel, and I got the following:

Sub Macro_name_graph2()
'
' Macro_name_graph2 Macro
'

'
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.FullSeriesCollection(1).name = "=""data1_1"""
    ActiveChart.FullSeriesCollection(1).Values = "==test_macro.xlsm!data1_1ord"
    ActiveChart.FullSeriesCollection(1).XValues = "==test_macro.xlsm!data1_1abs"
End Sub

what I put in the actual chart was ='test_macro.xlsm'!data1_1ord and ='test_macro.xlsm'!data1_1abs

But not when I try to run it again, I have an error 1004 at

 ActiveChart.FullSeriesCollection(1).Values = "==test_macro.xlsm!data1_1ord"

So I tried to put 

ActiveChart.FullSeriesCollection(1).Values = "=='test_macro.xlsm'!data1_1ord" 

And it didn't work. Can someone please help me with this?

Jan 7, 2023 in Others by Kithuzzz
• 38,010 points
483 views

1 answer to this question.

0 votes

Change the name of the workbook :

Sub Macro_name_graph2()
   With ActiveChart.SeriesCollection.NewSeries
        .Name = "=Book1!data1_1"
        .Values = "=Book1!data1_1ord"
        .XValues = "=Book1!data1_1abs"
    End With
End Sub
answered Jan 7, 2023 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer
0 votes
1 answer

How to increment the Range of a For Each loop - Excel VBA

Your formula seems to sum 1 single ...READ MORE

answered Jan 7, 2023 in Others by narikkadan
• 63,420 points
2,134 views
0 votes
1 answer

I want to compare two Excel files and highlight the differences with VBA

The workbook doesn't have the UsedRange property ...READ MORE

answered Jan 13, 2023 in Others by narikkadan
• 63,420 points
1,973 views
0 votes
1 answer

VBA copy data from other file - problem with file name change

To look for the source file, use ...READ MORE

answered Jan 20, 2023 in Others by narikkadan
• 63,420 points
433 views
0 votes
1 answer

How to modify Powerpoint Chart ChartData by Excel VBA

Example: Code: Set pptApp = GetObject(, "PowerPoint.Application") Set pptPres = ...READ MORE

answered Oct 16, 2022 in Others by narikkadan
• 63,420 points
2,363 views
0 votes
0 answers

xcel VBA Chart counting and formatting

I want to develop a macro that ...READ MORE

Oct 31, 2022 in Others by Kithuzzz
• 38,010 points
215 views
0 votes
1 answer

Automating production of graphs using VBA

You have to change: chrtname = Cells(i, 2).Value To: chrtname ...READ MORE

answered Jan 23, 2023 in Others by narikkadan
• 63,420 points
452 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
916 views
0 votes
1 answer

Create a hyperlink to a sheet with same name as the value in the selected cell in Excel through VBA

Credit to Spectral Instance who found the ...READ MORE

answered Feb 6, 2023 in Others by narikkadan
• 63,420 points
596 views
0 votes
1 answer

How to get the excel file name / path in VBA

Use FullName, for example: strFileFullName = ThisWorkbook.FullName ...READ MORE

answered Dec 23, 2022 in Others by narikkadan
• 63,420 points
380 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP