![]() |
How do I change the X axis scale on all charts in a workbook?
I have multiple charts on a number of worksheets in one workbook and I need
to have the same X axis scale on all of them. Thanks for any help |
How do I change the X axis scale on all charts in a workbook?
Unless you're using Excel 2007 it's easy. Double click the X axis on one
chart, and do all your adjustments before clicking on OK. Then select the next X axis and press the F4 function key (shortcut for Repeat Last Action). Repeat as needed. In Excel 2007 the F4 key no longer reliably repeats the last action. Sometimes it does, but often I'm left repeating things the long way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... I have multiple charts on a number of worksheets in one workbook and I need to have the same X axis scale on all of them. Thanks for any help |
How do I change the X axis scale on all charts in a workbook?
That will work better than what I am currently doing.
But what I really want is to use some reference cells to set the min max and divisions and then use a macro to update X axis. I can do this for one or two charts easily but I can't figure out how to apply it to all the charts in the workbook. Note: I have ~ 50 charts and they change periodically. hlmrspd "Jon Peltier" wrote: Unless you're using Excel 2007 it's easy. Double click the X axis on one chart, and do all your adjustments before clicking on OK. Then select the next X axis and press the F4 function key (shortcut for Repeat Last Action). Repeat as needed. In Excel 2007 the F4 key no longer reliably repeats the last action. Sometimes it does, but often I'm left repeating things the long way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... I have multiple charts on a number of worksheets in one workbook and I need to have the same X axis scale on all of them. Thanks for any help |
How do I change the X axis scale on all charts in a workbook?
The generic protocol for linking axis limits to cells is described he
http://peltiertech.com/Excel/Charts/...nkToSheet.html Instead of operating on a single chart, you would use (for embedded charts) For Each Sht In ActiveWorkbook.Sheets For Each ChtObj In Sht.ChartObjects With ChtObj.Chart ' code from article above End With Next Next or (for chart sheets) For Each Cht In ActiveWorkbook.Charts With Cht ' code from article above End With Next - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... That will work better than what I am currently doing. But what I really want is to use some reference cells to set the min max and divisions and then use a macro to update X axis. I can do this for one or two charts easily but I can't figure out how to apply it to all the charts in the workbook. Note: I have ~ 50 charts and they change periodically. hlmrspd "Jon Peltier" wrote: Unless you're using Excel 2007 it's easy. Double click the X axis on one chart, and do all your adjustments before clicking on OK. Then select the next X axis and press the F4 function key (shortcut for Repeat Last Action). Repeat as needed. In Excel 2007 the F4 key no longer reliably repeats the last action. Sometimes it does, but often I'm left repeating things the long way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... I have multiple charts on a number of worksheets in one workbook and I need to have the same X axis scale on all of them. Thanks for any help |
How do I change the X axis scale on all charts in a workbook?
That work great, I added a macro to return the X axis to auto as well.
This sure made my work easier. Thanks!!! Here are the Macros: Sub ChangeXAxisScale() ' ' Change the X axis on all charts based on cell input ' For Each Sht In ActiveWorkbook.Sheets For Each ChtObj In Sht.ChartObjects With ChtObj.Chart ' Category (X) Axis With .Axes(xlCategory) .MaximumScale = ActiveSheet.Range("'PCS Pwr,T'!$A$14").Value .MinimumScale = ActiveSheet.Range("'PCS Pwr,T'!$A$16").Value .MajorUnit = ActiveSheet.Range("'PCS Pwr,T'!$A$18").Value End With End With Next Next End Sub Sub returnXaxistoauto() ' ' returntoauto Macro returns the X axis scale to auto ' ' For Each Sht In ActiveWorkbook.Sheets For Each ChtObj In Sht.ChartObjects With ChtObj.Chart ' Category (X) Axis With .Axes(xlCategory) .MinimumScaleIsAuto = True .MaximumScaleIsAuto = True .MinorUnitIsAuto = True .MajorUnitIsAuto = True End With End With Next Next End Sub "Jon Peltier" wrote: The generic protocol for linking axis limits to cells is described he http://peltiertech.com/Excel/Charts/...nkToSheet.html Instead of operating on a single chart, you would use (for embedded charts) For Each Sht In ActiveWorkbook.Sheets For Each ChtObj In Sht.ChartObjects With ChtObj.Chart ' code from article above End With Next Next or (for chart sheets) For Each Cht In ActiveWorkbook.Charts With Cht ' code from article above End With Next - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... That will work better than what I am currently doing. But what I really want is to use some reference cells to set the min max and divisions and then use a macro to update X axis. I can do this for one or two charts easily but I can't figure out how to apply it to all the charts in the workbook. Note: I have ~ 50 charts and they change periodically. hlmrspd "Jon Peltier" wrote: Unless you're using Excel 2007 it's easy. Double click the X axis on one chart, and do all your adjustments before clicking on OK. Then select the next X axis and press the F4 function key (shortcut for Repeat Last Action). Repeat as needed. In Excel 2007 the F4 key no longer reliably repeats the last action. Sometimes it does, but often I'm left repeating things the long way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... I have multiple charts on a number of worksheets in one workbook and I need to have the same X axis scale on all of them. Thanks for any help |
How do I change the X axis scale on all charts in a workbook?
Jon,
Could you tell me how I could make something like this work for multiple (50+) Chart Sheets with a different x-axis (min,max) and a Source Data Series (X) Range. I have a worksheet with 'col A' = ChartSht Name; 'col B' = X-Min; 'col C' = Y-Max; 'col D' = m & 'col E' = n for Series ={m,n} A B C D E Sec1 (1) 0 1000 0 1000 Sec1 (2) 1000 2000 1000 2000 Sec1 (3) 2000 3000 2000 3000 I would like all the charts to update with this data when I run a macro "Jon Peltier" wrote: The generic protocol for linking axis limits to cells is described he http://peltiertech.com/Excel/Charts/...nkToSheet.html Instead of operating on a single chart, you would use (for embedded charts) For Each Sht In ActiveWorkbook.Sheets For Each ChtObj In Sht.ChartObjects With ChtObj.Chart ' code from article above End With Next Next or (for chart sheets) For Each Cht In ActiveWorkbook.Charts With Cht ' code from article above End With Next - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... That will work better than what I am currently doing. But what I really want is to use some reference cells to set the min max and divisions and then use a macro to update X axis. I can do this for one or two charts easily but I can't figure out how to apply it to all the charts in the workbook. Note: I have ~ 50 charts and they change periodically. hlmrspd "Jon Peltier" wrote: Unless you're using Excel 2007 it's easy. Double click the X axis on one chart, and do all your adjustments before clicking on OK. Then select the next X axis and press the F4 function key (shortcut for Repeat Last Action). Repeat as needed. In Excel 2007 the F4 key no longer reliably repeats the last action. Sometimes it does, but often I'm left repeating things the long way. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "hlmrspd" wrote in message ... I have multiple charts on a number of worksheets in one workbook and I need to have the same X axis scale on all of them. Thanks for any help |
How do I change the X axis scale on all charts in a workbook?
This only affects the chart object within the active sheet, for me. How would I modify it to work with all charts in the workbook? I have 60+ charts I would like to update...
I am currently trying to use: --- Sub FormatYAxis() For Each Sht In ActiveWorkbook.Sheets For Each ChtObj In Sht.ChartObjects With ChtObj.Chart ' Category (Y) Axis With .Axes(xlValue) .MinimumScale = Range("B11").Value .MaximumScale = Range("B12").Value .MinorUnit = Range("B13").Value .MajorUnit = Range("B14").Value End With End With Next Next End Sub |
All times are GMT +1. The time now is 02:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com