Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel VBA-.DataLabels.NumberFormat-“数据标签”;对象没有';“不支持此属性或方法”;错误_Excel_Vba_Excel Charts - Fatal编程技术网

Excel VBA-.DataLabels.NumberFormat-“数据标签”;对象没有';“不支持此属性或方法”;错误

Excel VBA-.DataLabels.NumberFormat-“数据标签”;对象没有';“不支持此属性或方法”;错误,excel,vba,excel-charts,Excel,Vba,Excel Charts,我试图更改数据标签的数字格式,但出现错误(粗体行)?你知道怎么了吗 Range("R1:S" & NRegion).Select ActiveSheet.Shapes.AddChart2(494, xlRegionMap).Name = "Wykres 2" Set wykres2 = Sheets("Raport").ChartObjects("Wykres 2").Chart Sheets("Raport").ChartObjects("Wykres 2").Activa

我试图更改数据标签的数字格式,但出现错误(粗体行)?你知道怎么了吗

Range("R1:S" & NRegion).Select
ActiveSheet.Shapes.AddChart2(494, xlRegionMap).Name = "Wykres 2"

Set wykres2 = Sheets("Raport").ChartObjects("Wykres 2").Chart

    Sheets("Raport").ChartObjects("Wykres 2").Activate
    ActiveChart.Legend.Position = xlBottom
    ActiveChart.Legend.Format.Line.ForeColor.ObjectThemeColor = msoThemeColorText1
    ActiveChart.ChartTitle.Text = "Wartość zamówień w województwach"
    ActiveChart.ChartTitle.Format.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
    ActiveChart.ChartTitle.Format.TextFrame2.TextRange.Font.Bold = msoTrue
    wykres2.FullSeriesCollection(1).ApplyDataLabels
    **wykres2.FullSeriesCollection(1).DataLabels.NumberFormat = "# ##0 zł"**
    wykres2.FullSeriesCollection(1).Name = " "

我使用了SeriesCollection(1)而不是FullSeriesCollection(1),但它仍然不起作用。您的图表是否已经添加了一些值?如果图表为空,VBA将无法更改数据标签等。是的,这些值将添加到i如何使用
ActiveChart
而不是引用
wykres2
?所以应该是:
ActiveChar.FullSeriesCollection(1.ApplyDataLabels
。顺便问一下,这一行显示的错误消息是什么?