ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Create macro to calculate data range for a running chart (https://www.excelbanter.com/excel-worksheet-functions/185386-create-macro-calculate-data-range-running-chart.html)

James Lucero

Create macro to calculate data range for a running chart
 
I need to create a running chart that will plot the production rate and
associated dates of four employees. I have seen examples of macros to
automatically resize a data range as new data is entered over time. That
accomplishes a portion of my problem but i also need a macro that will sort
the data by employee last name and then plot on a chart based on that sorted
data.

ryguy7272

Create macro to calculate data range for a running chart
 
Lots of sort macros out there, on Google for instance
Here is one:
Sub macSort()
Range("A1:A22").Select ' put the range here
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
end sub

This is a great reference:
http://www.mvps.org/dmcritchie/excel/sorting.htm

Turn on the macro recorder and try it a few times yourself.

As for the dynamic range, all the info. you need is right he
http://www.ozgrid.com/Excel/DynamicRanges.htm
http://www.exceluser.com/explore/dynname1.htm


Regards,
Ryan--
--
RyGuy


"James Lucero" wrote:

I need to create a running chart that will plot the production rate and
associated dates of four employees. I have seen examples of macros to
automatically resize a data range as new data is entered over time. That
accomplishes a portion of my problem but i also need a macro that will sort
the data by employee last name and then plot on a chart based on that sorted
data.



All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com