Home |
Search |
Today's Posts |
#1
|
|||
|
|||
format data series line width default
Hi
Is there a way of setting the default width of lines for a series in line chart? like in the tools-options-color, where you can set the default colors. ( or the vb code of setting the colours ActiveWorkbook.Colors(25) = RGB(51, 102, 255)) many thanks in advance Noel |
#2
|
|||
|
|||
format data series line width default
You can't set the line width the same as you can modify the color
palette, but you can format the line width and the rest of the chart features, then save the chart as a custom chart type: http://peltiertech.com/Excel/ChartsH...stomTypes.html The syntax for setting the line width in code is easy enough to obtain. Turn on the macro recorder, then change the line width of a series, then see what the recorder recorded. I just got this: Sub Macro2() ' ' Macro2 Macro ' Macro recorded 11/1/2005 by Jon Peltier ' ' ActiveChart.SeriesCollection(1).Select With Selection.Border .ColorIndex = 57 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = xlAutomatic .MarkerForegroundColorIndex = xlAutomatic .MarkerStyle = xlAutomatic .Smooth = False .MarkerSize = 7 .Shadow = False End With End Sub which when ignoring the defaults and irrelevant changes is reduced to this: Sub Macro2a() ActiveChart.SeriesCollection(1).Border.Weight = xlMedium End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ NoelH wrote: Hi Is there a way of setting the default width of lines for a series in line chart? like in the tools-options-color, where you can set the default colors. ( or the vb code of setting the colours ActiveWorkbook.Colors(25) = RGB(51, 102, 255)) many thanks in advance Noel |
#3
|
|||
|
|||
format data series line width default
Hi Jon
Thank you for your reply. however I have different number of series. ie SeriesCollection (1) ~ (7). I'm having trouble in writing the loop to input the variable, I have been using if...then. [if there is data series (4), then run the ActiveChart.SeriesCollection(1).Border.Weight = xlMedium I'm working on fixing this error in my learning. Thanks for your help. - Noel "Jon Peltier" wrote: You can't set the line width the same as you can modify the color palette, but you can format the line width and the rest of the chart features, then save the chart as a custom chart type: http://peltiertech.com/Excel/ChartsH...stomTypes.html The syntax for setting the line width in code is easy enough to obtain. Turn on the macro recorder, then change the line width of a series, then see what the recorder recorded. I just got this: Sub Macro2() ' ' Macro2 Macro ' Macro recorded 11/1/2005 by Jon Peltier ' ' ActiveChart.SeriesCollection(1).Select With Selection.Border .ColorIndex = 57 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = xlAutomatic .MarkerForegroundColorIndex = xlAutomatic .MarkerStyle = xlAutomatic .Smooth = False .MarkerSize = 7 .Shadow = False End With End Sub which when ignoring the defaults and irrelevant changes is reduced to this: Sub Macro2a() ActiveChart.SeriesCollection(1).Border.Weight = xlMedium End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ NoelH wrote: Hi Is there a way of setting the default width of lines for a series in line chart? like in the tools-options-color, where you can set the default colors. ( or the vb code of setting the colours ActiveWorkbook.Colors(25) = RGB(51, 102, 255)) many thanks in advance Noel |
#4
|
|||
|
|||
format data series line width default
Two ways come to mind.
Dim srs as Series For Each srs In ActiveChart.SeriesCollection srs.Border.Weight = xlMedium Next or Dim iSrs as Integer For iSrs = 1 To ActiveChart.SeriesCollection.Count ActiveChart.SeriesCollection(iSrs).Border.Weight = xlMedium Next - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ NoelH wrote: Hi Jon Thank you for your reply. however I have different number of series. ie SeriesCollection (1) ~ (7). I'm having trouble in writing the loop to input the variable, I have been using if...then. [if there is data series (4), then run the ActiveChart.SeriesCollection(1).Border.Weight = xlMedium I'm working on fixing this error in my learning. Thanks for your help. - Noel "Jon Peltier" wrote: You can't set the line width the same as you can modify the color palette, but you can format the line width and the rest of the chart features, then save the chart as a custom chart type: http://peltiertech.com/Excel/ChartsH...stomTypes.html The syntax for setting the line width in code is easy enough to obtain. Turn on the macro recorder, then change the line width of a series, then see what the recorder recorded. I just got this: Sub Macro2() ' ' Macro2 Macro ' Macro recorded 11/1/2005 by Jon Peltier ' ' ActiveChart.SeriesCollection(1).Select With Selection.Border .ColorIndex = 57 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = xlAutomatic .MarkerForegroundColorIndex = xlAutomatic .MarkerStyle = xlAutomatic .Smooth = False .MarkerSize = 7 .Shadow = False End With End Sub which when ignoring the defaults and irrelevant changes is reduced to this: Sub Macro2a() ActiveChart.SeriesCollection(1).Border.Weight = xlMedium End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ NoelH wrote: Hi Is there a way of setting the default width of lines for a series in line chart? like in the tools-options-color, where you can set the default colors. ( or the vb code of setting the colours ActiveWorkbook.Colors(25) = RGB(51, 102, 255)) many thanks in advance Noel |
#5
|
|||
|
|||
format data series line width default
Thank you, works fantastically
"Jon Peltier" wrote: Two ways come to mind. Dim srs as Series For Each srs In ActiveChart.SeriesCollection srs.Border.Weight = xlMedium Next or Dim iSrs as Integer For iSrs = 1 To ActiveChart.SeriesCollection.Count ActiveChart.SeriesCollection(iSrs).Border.Weight = xlMedium Next - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ NoelH wrote: Hi Jon Thank you for your reply. however I have different number of series. ie SeriesCollection (1) ~ (7). I'm having trouble in writing the loop to input the variable, I have been using if...then. [if there is data series (4), then run the ActiveChart.SeriesCollection(1).Border.Weight = xlMedium I'm working on fixing this error in my learning. Thanks for your help. - Noel "Jon Peltier" wrote: You can't set the line width the same as you can modify the color palette, but you can format the line width and the rest of the chart features, then save the chart as a custom chart type: http://peltiertech.com/Excel/ChartsH...stomTypes.html The syntax for setting the line width in code is easy enough to obtain. Turn on the macro recorder, then change the line width of a series, then see what the recorder recorded. I just got this: Sub Macro2() ' ' Macro2 Macro ' Macro recorded 11/1/2005 by Jon Peltier ' ' ActiveChart.SeriesCollection(1).Select With Selection.Border .ColorIndex = 57 .Weight = xlMedium .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = xlAutomatic .MarkerForegroundColorIndex = xlAutomatic .MarkerStyle = xlAutomatic .Smooth = False .MarkerSize = 7 .Shadow = False End With End Sub which when ignoring the defaults and irrelevant changes is reduced to this: Sub Macro2a() ActiveChart.SeriesCollection(1).Border.Weight = xlMedium End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ NoelH wrote: Hi Is there a way of setting the default width of lines for a series in line chart? like in the tools-options-color, where you can set the default colors. ( or the vb code of setting the colours ActiveWorkbook.Colors(25) = RGB(51, 102, 255)) many thanks in advance Noel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
missing data points causes my line graph not to connect | Charts and Charting in Excel | |||
Charts Line Types for Multiple Data Series not Printing Properly | Charts and Charting in Excel | |||
how do I change a line series to a column series in excel? | Charts and Charting in Excel | |||
Graff data series | Excel Discussion (Misc queries) | |||
How can I set the default line width | Charts and Charting in Excel |