我可以通过应用程序的.Selection
属性选择区域。
(我正在使用python访问excel com接口)
我想知道用户选择了多少行和列,例如
input:
user has selected A1:G8
output:
the selected range starts from Column 1 (by selection.Column)
the selected range starts from Row 1 (by selection.Column)
the selected range is spanning 7 rows (by ?)
the selected range is spanning 8 columns (by ?)
我正在查看MSDN的Range interface,但该属性对此问题似乎没有帮助。
答案 0 :(得分:0)
从VBA,您可以这样做:
Debug.Print Selection.Rows.Count
Debug.Print Selection.Columns.Count
Debug.Print Selection.Row
Debug.Print Selection.Column
选择A1:G8后,返回
8
7
1
1
是否可以轻松转换为Python>