vba code help

isacp

Board Regular
Joined
Dec 16, 2004
Messages
135
i would like to write a macro that makes a chart.
i want to write at each change in column c
charts.add ...............

i dont know the code that will say 'at each canhge in column c do somthing
can you help me
once again thank you
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

parry

MrExcel MVP
Joined
Aug 20, 2002
Messages
3,355
Use the macro recorder to create the code for the chart. You could end up with a hell of a lot of charts. Are you sure thats what you want - a new chart every time?
 

isacp

Board Regular
Joined
Dec 16, 2004
Messages
135
thanx fo you help

the thing is that the part of the code with the chart i have i need the part
"at each change in"
you see i have a sales report and in column c are each salesreps department so i want a chart for each dept.
so the code i need is
at each change in
the truth is this applies for anything
"at each change in c.copy.range("F:F")"
if you could write me that code that would be great
thank you again for your time.
it appreciated
 

parry

MrExcel MVP
Joined
Aug 20, 2002
Messages
3,355
Hi again, when you have a chart it has a source range it looks at to get its values. When the data in the source changes it automatically updates. The only thing you may need to do is extend the range it looks at if you add more data.

Im not sure what you mean by c.copy.range("F:F")" . Do you want to copy the whole row of C and paste into F? Again, try the macro recorder to see the code for this.
 

isacp

Board Regular
Joined
Dec 16, 2004
Messages
135
every day i get a report i get a daily report a weekly and a monthly.
the report has (in order of columns) the persons department his name date and the five different figures.
right now i manually make a chart for each dept. consisting of the names and figures. i have five charts for each dept. the people change dept. daily and so this is for a daily process.
i want to write a macro that makes a chart based on the department the person is in?
againg i appreciate your help and if i can clarify aby further please ask i will try
thank you
 

parry

MrExcel MVP
Joined
Aug 20, 2002
Messages
3,355
The steps I see you would need are

1) Filter the data to only show the one you need
2) Copy that data to another sheet
3) Create a chart off the data

In order to do code you need to be specific about where ranges are copying from and where they are going to. If you use the macro recorder to achieve these three steps then you will have the bulk of the code. Then a small piece of code could be added to repeat the process (ie, filter on the next one, copy to a new sheet, create a chart). Run the macro to do the action for one department then post the code and Ill help with th loop part. You may wish to create a list of all the departments so its just a matter of looping through this to determine the filter criteria.

You could also investigate using a pivot chart - look that up in the help.

hth
 

Forum statistics

Threads
1,148,274
Messages
5,745,796
Members
423,973
Latest member
man_this_is_hard

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
Top