我可以通过应用程序的.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的范围接口,但属性似乎对这个问题没有帮助。
在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吗>