VBA:在“选择”是图表的工作表中获取选定的范围 [英] VBA: Get selected Range in a Worksheet where the Selection is a Chart
本文介绍了VBA:在“选择”是图表的工作表中获取选定的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
? TypeName(Selection)
ChartArea
所以我不能使用 / code>来获取选定的
范围
,即使它在那里(按Esc返回到选定的单元格范围)。
如何在VBA中检索 Range
?
PS:我怀疑是Q& A适用于其他 Shape
s。
解决方案
您可以使用 Window
对象的 RangeSelection
属性(请参阅 this )。
I have a Worksheet, with a Chart in it. If I select a range of cells, and then I select the Chart, then in the immediate window of the VBE
? TypeName(Selection)
ChartArea
So I cannot use Selection
to get the selected Range
, even if it is there (pressing Esc returns to the selected range of cells).
How can I retrieve that Range
in VBA?
PS: I suspect the same Q&A applies to other Shape
s.
解决方案
You can use the RangeSelection
property of the Window
object (see this).
这篇关于VBA:在“选择”是图表的工作表中获取选定的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文