我想编写一段代码,无论我在Excel中选择一个还是多个图表,它都能正常工作。
实际上我使用这段代码,但是当只选择一个图表时,它失败了:
Dim obj As Object
'Check if any charts have been selected
If Not ActiveChart Is Nothing Then
MsgBox ("Select multiple charts")
Else
For Each obj In Selection
'If more than one chart selected
If TypeName(obj) = "ChartObject" Then
Call AnotherMacro(obj.Chart)
End If
Next
End If
我正在寻找一个解决方案工作到一个独特的潜艇。
谢谢你的帮忙
1条答案
按热度按时间xoshrz7s1#
请尝试下一种方法: