gpt4 book ai didi

excel:获取当前图表的索引

转载 作者:行者123 更新时间:2023-12-03 00:32:01 25 4
gpt4 key购买 nike

我创建了一个新图表

Sheets("DatenFilledChart").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlArea
ActiveChart.SetSourceData Source:=Range("DatenFilledChart!$B$4:$B$1004")
ActiveChart.SeriesCollection(1).XValues = "=DatenFilledChart!$A$4:$A$1004"
ActiveChart.SeriesCollection(1).Name = "=DatenFilledChart!$B$1"

为了使用当前图表,我想保存其索引

indexOfChart = ActiveChart.Index

但是失败了

The method Index is invalid for a object _Chart

我做错了什么?

最佳答案

尝试使用这个:

indexOfChart = Shapes.Count

而不是

indexOfChart = ActiveChart.Index

Index 属性不适用于图表集合:

Index Property

The position of a Tab object within a Tabs collection or a Page object in a Pages collection.

了解更多:http://msdn.microsoft.com/en-us/library/office/ff194426.aspx

关于excel:获取当前图表的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15006252/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com