Excel 更改数据标签的日期类型
我一直在努力修复数据标签的数据类型格式。不幸的是,一切都没有结果。我希望数据标签的fomat值为0.00%。我怎样才能改变它 这是一个程序示例Excel 更改数据标签的日期类型,excel,vba,Excel,Vba,我一直在努力修复数据标签的数据类型格式。不幸的是,一切都没有结果。我希望数据标签的fomat值为0.00%。我怎样才能改变它 这是一个程序示例 Dim OAPList As Range Dim SingleCell As Range Dim Counter As Integer Set OAPList = Worksheets("Sheet2").Range("E2:E" & lw) ActiveChart.FullSeriesCollection(1).ChartType = xlC
Dim OAPList As Range
Dim SingleCell As Range
Dim Counter As Integer
Set OAPList = Worksheets("Sheet2").Range("E2:E" & lw)
ActiveChart.FullSeriesCollection(1).ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).AxisGroup = 1
ActiveChart.SeriesCollection(1).HasDataLabels = True
Counter = 1
With ActiveChart.SeriesCollection(1)
For Each SingleCell In OAPList
ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = SingleCell.Value
Counter = Counter + 1
Next SingleCell
.DataLabels.ShowValue = True
.DataLabels.NumberFormat = "0%"
'.DataLabels.Position = xlLabelPositionInsideEnd
.DataLabels.Format.AutoShapeType = msoShapeRectangularCallout
.DataLabels.Format.Line.Visible = msoTrue
End With
ActiveChart.SeriesCollection(2).Name = "Estimated Hours"
ActiveChart.FullSeriesCollection(2).ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(2).AxisGroup = 1
尝试更改此行:
'With ActiveChart.SeriesCollection(1)
With ActiveChart.FullSeriesCollection(1)
为每个循环更改以下行:
ActiveChart.FullSeriesCollection(1).Points(Counter).DataLabel.Text = Format(SingleCell.Value, "0%")
谢谢你的回复。我更改了代码并运行了程序。它显示了相同的结果。