+ Reply to Thread
Results 1 to 8 of 8

format data series line width default

  1. #1
    Jon Peltier
    Guest

    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. #2
    NoelH
    Guest

    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. #3
    Jon Peltier
    Guest

    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. #4
    NoelH
    Guest

    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. #5
    Jon Peltier
    Guest

    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. #6
    NoelH
    Guest

    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. #7
    Jon Peltier
    Guest

    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. #8
    NoelH
    Guest

    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
    > >>

    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1