|
|
|
||||||||||||
|
#1
|
|||
|
|||
|
Re: 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 |
|
#2
|
|||
|
|||
|
Re: 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 > |
|
#3
|
|||
|
|||
|
Re: 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 >> |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
Re: 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 |
|
#6
|
|||
|
|||
|
Re: 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 > |
|
#7
|
|||
|
|||
|
Re: 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 >> |
|
#8
|
|||
|
|||
|
Re: 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 > >> > |
![]() |
| Bookmarks |
New topics in Excel Charting
|
|
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|