【问题标题】:Highlight each bar in order in Excel 2007 Bar Chart在 Excel 2007 条形图中按顺序突出显示每个条形
【发布时间】:2011-05-23 19:42:17
【问题描述】:

我在 Excel 2007 中有一个条形图。我想分别更改图表中每个条形的格式,然后将其更改回原来的格式。整体效果是让每个条看起来都按顺序突出显示。

有没有办法用 VBA 做到这一点?

【问题讨论】:

    标签: vba format excel-2007 bar-chart


    【解决方案1】:

    这可能会让你开始:

    Sub Tester()
    
        Dim oCht As Excel.Chart, s As Series
        Dim x As Integer, i As Integer
        Dim oldColor As Long
    
        Set oCht = ActiveSheet.ChartObjects("Chart 1").Chart
        For x = 1 To oCht.SeriesCollection.Count
            Set s = oCht.SeriesCollection(x)
            For i = 1 To s.Points.Count
                With s.Points(i).Interior
                    oldColor = .Color
                    .Color = vbRed
                    DoEvents
                    Application.Wait Now + TimeSerial(0, 0, 2)
                    .Color = oldColor
                    DoEvents
                End With
            Next i
        Next x
    
    End Sub
    

    【讨论】:

      猜你喜欢
      • 2014-04-04
      • 2019-03-26
      • 2018-10-03
      • 1970-01-01
      • 2019-06-13
      • 2023-01-15
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      相关资源
      最近更新 更多