creating Charts by VBA code

leshem

New Member
Joined
Sep 23, 2002
Messages
49
Hello All,
can you please help me, I need to create a chart by code only, meaning calling the right dialogs of whole process as in standard toolbar. I need the user to have the option of creating it on the current worksheet only.
Notice, only by code, ad a regard of clicking a button.

10X 10X 10X .
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
leshem,

Turn on Your macro-recorder and create a chart.

Explore the recorded code and make necessary adjustment in it.

If You need further help please return to the Board again.

With kind regards,
Dennis
 
Upvote 0
Hi leshem

Have you tried using the Macro recorder?

Goto Tools / Macro / Record new macro

Then prepare a chart in the normal way with your chosen data, switch off the recorder at the end and examine the code.

It should produce something similar to this:<pre>
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 03/10/2002 by Richie
'

'
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("G13:G17"), PlotBy _
:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R13C6:R17C6"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
End Sub</pre>

HTH

EDIT: Sorry Dennis - you are too quick for me! ;-

_________________<font color="blue"> «««<font color="red">¤<font color="blue"><font size=+1>Richie</font><font color="red">¤<font color="blue"> »»»</font>

caffeine_sample.gif
</gif>
This message was edited by Richie(UK) on 2002-10-03 05:47
 
Upvote 0
thanks Richie and Dennis.
I already done what you seggested.
Sorry for not making myself clear enough.
I'll try again.
I dont have the standard menu bar and tool bar. there for I dont have the regular option for creating Charts.
What you suggested will create allways the same charts for the application, same location, same size , same sheet and all.
what I want is to create a new menu that performs the option of creating a new chart. meaning - openng the right dialog boxes, basicly, performing by new written code, the standard action of Chart Wizard.
10x 10x :)
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,876
Members
449,056
Latest member
ruhulaminappu

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