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.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,
 
Upvote 0
If you delete the data where will the chart get its data from?
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,025
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top