如何在Excel工作表中查找当前选定单元格的范围 [英] How to find the range of currently selected cells in an excel worksheet

查看:403
本文介绍了如何在Excel工作表中查找当前选定单元格的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!这一定很容易,但是我已经挣扎了一段时间(是的,我用谷歌搜索,但无法理解我发现的东西).

我的过程收到一个excel工作簿作为输入参数.我需要找到当前选择的单元格范围...

到目前为止,我唯一的代码行

Hello everyone! This must be quite easy, but I have been struggling for a while now (and yes, I googled but could not make sense of what I found).

My procedure receives an excel workbook as input parameter. I need to find the currently selected cell range...

My only line of code so far

xlWorksheet = xlInputWorkBook.ActiveSheet



有谁知道如何检索选定的单元格范围的线索吗?

我的猜测是xlWorksheet.Cells.SomePropertyICanNotFind

TIA为您提供帮助!

PS:我没有使用VBA,而是使用VB.NET来构建一个独立的应用程序



Does anyone have a clue as how to i retrieve the selected cell range?

My guess is xlWorksheet.Cells.SomePropertyICanNotFind

TIA for your help!

PS: I am not using VBA, but VB.NET to build a standalone application

推荐答案

您正在寻找的实际上只是您所期望的...并且那是Selection

http://msdn.microsoft.com/en-us/library/aa196885%28v = office.11​​%29.aspx [ ^ ]

在vb.net中,它是Application的属性.这是因为Excel是单用户,因此一次只能选择一个.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application_properties.aspx [ ^ ]

祝你好运!
What you are looking for is actually just what you would expect... and that is Selection

http://msdn.microsoft.com/en-us/library/aa196885%28v=office.11%29.aspx[^]

In vb.net it is a property of Application. This is because Excel is single user and therefor can have only one selection at a time.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application_properties.aspx[^]

Good luck!


这篇关于如何在Excel工作表中查找当前选定单元格的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆