Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Chart through excel vba

Status
Not open for further replies.

Jaybye

Technical User
Sep 14, 2010
3
ZA
Good morning

I'm new to vba and need help please.

I would like to create a chart in excel using vba depending on two criteria selections I made on my userform. The selections are a combobox value and an automated textbox value.
I have sheets for every institution in the same workbook where chart data gets copied to the next available row. On my userform is a commandbutton which I want the chart to be created depending on my combobox selection and also the textbox value. Eg. When I select "ERH" from the combobox and the textbox value is "FY 1", the commandbutton should collect the data stored in the sheet named "ERHGraph" and select the range based on the textbox value eg. "FY 1" and then create a line chart.
After the chart is created I would like it to be saved in a specified directory.
The textbox value starts at "FY 1" to "FY 10" for every institution. I have about 5 institutions per workbook and it takes forever to chart the data manually.
I attached an extract of my workbook for clearity.

Thanks for the help.
Jaybye
 


Hi,

Your link will not work.

Check this out faq707-4811

Why do you need to CREATE a chart via VBA, ie on-the-fly? I can count the number of times I have created a chart via VBA on one hand. I cannot remember how many times I have modified charts via VBA.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



I have sheets for every institution in the same workbook
That is usually a huge mistake! It is almost always better to have ALL your data in ONE sheet in ONE table.

I would also recommend ONE chart with source data on ONE sheet in ONE table.

All those ONEs are much easier to maintain than dozens of sheets, tables and charts. After all, you PROBABLY only view ONE chart at a time.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



Oh, yes, and one other tip: Use your macro recorder.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top