[英]How do I get the first Cell coordinates for a range for using Interop.Excel?
I am working on a small addin for excel for where I work and I need to find the starting position (x and y) for a selected cell range.我正在为我工作的地方为 excel 开发一个小插件,我需要为选定的单元格范围找到起始 position(x 和 y)。
Here is some code:这是一些代码:
using Excel = Microsoft.Office.Interop.Excel;
Excel.Range thisRange = thisSheet.Cells.Application.Selection.SpecialCells(
Excel.XlCellType.xlCellTypeVisible,
Type.Missing);
where thisSheet is an Excel.Worksheet
.其中 thisSheet 是
Excel.Worksheet
。
I can find the number of rows and columns using:我可以使用以下方法找到行数和列数:
int r = thisRange.Rows.Count;
int c = thisRange.Columns.Count;
but I am trying to find the X and Y position of the first cell in the selected range.但我试图找到所选范围内第一个单元格的 X 和 Y position。 Can anyone please help?
有人可以帮忙吗? Thanks
谢谢
I was able to achieve this by using Range.Row and Range.Column我能够通过使用Range.Row和Range.Column来实现这一点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.