How do I find which cells are selected on an Excel worksheet?

时光怂恿深爱的人放手 提交于 2019-12-10 16:43:48

问题


I need to be able to use C# and Excel interop to determine which cells are selected in a workbook/worksheet. It would be nice if there were something like this defined in Excel:

Excel.Range Worksheet.GetSelectedCells();

But I don't find that in any documentation. How can I do this?

tia.


回答1:


Use Application.Selection which will return a Range.




回答2:


I guess you can use the ActiveCell property of the Excel Application object. It would return you a Range object.

HTH Rauts



来源:https://stackoverflow.com/questions/3978179/how-do-i-find-which-cells-are-selected-on-an-excel-worksheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!