【问题标题】:Scatter chart - Convertible filling between with and without散点图 - 有和没有之间的可转换填充
【发布时间】:2020-09-16 01:43:40
【问题描述】:

使用这些代码,我想制作带有填充和不带填充标记的可转换 XY 散点图。 但是一旦标记转换为不填充并返回填充,标记不再转换为不填充。 如果我保存并关闭,那么它会再次起作用。 请您推荐我需要更新的点吗?

转换为不填充

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.FullSeriesCollection(1).Select
Selection.MarkerSize = 10
With Selection
    .Format.Fill.Visible = False
    .Format.Line.Visible = msoTrue
    .Format.Line.Weight = 1
    .Border.LineStyle = xlLineStyleNone 'Remove lines between points
End With

用填充转换成

    ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.FullSeriesCollection(1).Select
Selection.MarkerSize = 10
With Selection
    .Format.Fill.Visible = msoTrue
    .Format.Fill.Solid
    .Format.Fill.ForeColor.RGB = RGB(100, 100, 0)
    .Format.Line.Visible = msoTrue
    .Format.Line.Weight = 5
    .Border.LineStyle = xlLineStyleNone 'Remove lines between points
End With

谢谢。

【问题讨论】:

    标签: excel vba scatter excel-charts


    【解决方案1】:

    试试,

    Sub test1()
        Dim Cht As Chart
        Dim Srs As Series
        
        Set Cht = ActiveSheet.ChartObjects("Chart 1").Chart
        Set Srs = Cht.SeriesCollection(1)
        
        With Srs
            .MarkerSize = 10
            .Format.Fill.Visible = msoFalse
            .Format.Line.Visible = msoFalse
            .Format.Line.Weight = 1
            .Border.LineStyle = xlLineStyleNone 'Remove lines between points
        End With
    End Sub
    Sub test2()
        Dim Cht As Chart
        Dim Srs As Series
        
        Set Cht = ActiveSheet.ChartObjects("Chart 1").Chart
        Set Srs = Cht.SeriesCollection(1)
        
        With Srs
            .MarkerSize = 10
            .Format.Fill.Visible = msoTrue
            .Format.Line.Visible = msoTrue
            .Format.Line.Weight = 5
            .Border.LineStyle = xlLineStyleNone 'Remove lines between points
        End With
    End Sub
    

    【讨论】:

    • 你好。感谢您的检查。测试 1 适用于去除填充物。但测试 2 没有恢复填充。
    猜你喜欢
    • 1970-01-01
    • 2020-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多