简体   繁体   English

如何查找在 Excel 工作表上选择了哪些单元格?

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

I need to be able to use C# and Excel interop to determine which cells are selected in a workbook/worksheet.我需要能够使用 C# 和 Excel 互操作来确定在工作簿/工作表中选择了哪些单元格。 It would be nice if there were something like this defined in Excel:如果在 Excel 中定义了这样的东西,那就太好了:

Excel.Range Worksheet.GetSelectedCells();

使用Application.Selection它将返回一个范围。

I guess you can use the ActiveCell property of the Excel Application object.我猜您可以使用 Excel Application 对象的 ActiveCell 属性。 It would return you a Range object.它会返回一个 Range 对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM