Setsourcedata from a temporary worksheet (VB6/not VBA)

Randi_Eck

New Member
Joined
Oct 1, 2016
Messages
1
I have placed 2 sets of data on worksheet(3), and successfully created a column chart on worksheet(1) & another on worksheet(2). I then want to save the spreadsheet, without worksheet(3).
If I delete or clear the worksheet before doing the SaveAs, the charts are garbage.

Charts were created via:
Dim histo As Object
Set histo = .ChartObjects.Add(.Range("B" & curRow).Left, .Range("B" & curRow).Top, _
400, 175).Chart
histo.ChartType = xlColumnClustered
histo.SetSourceData Source:= _
tmpSheet.Range(tmpSheet.Cells(topRow, 1), _
tmpSheet.Cells(tmpCurRow, 5)), _
PlotBy:=xlRows

[Sorry if this isn't the most elegant; it's my first VB program.]
Is there a way to have the charts created on the 2 worksheets, then wipe out its data on the 'tmpSheet' worksheet, then save the workbook?

Thx.
 

RickXL

MrExcel MVP
Joined
Sep 9, 2013
Messages
4,314
Hi and welcome to the MrExcel Message Board.

Sorry, no speak VB6.

However, the charts will be "garbage" if you remove the data they are trying to plot.

Another approach would be to Copy the Chart and then Paste it back as a .png file, for instance. After that you will be able to remove the data and the original Chart while leaving the plotted data on view.

Regards,
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
If you delete the data where will the chart get its data from?
 

Forum statistics

Threads
1,082,139
Messages
5,363,363
Members
400,731
Latest member
Jackserver

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top