问题描述
我试图让Excel中的一个按钮,复制一定范围内从活动工作簿中到另一个工作簿的细胞。该范围的复制完美的作品时,我指定一个固定的范围内,但我难倒就如何找出点击按钮的行。
I am trying to make a button in Excel which copies a certain range of cells from the active workbook to another workbook. The copying of this range works perfectly when I specify a fixed range, but I am stumped on how to figure out the row of the clicked button.
每一行包含7左右的细胞,并在第8单元中包含与连接到它(按钮)的宏的形状。
当用户presses该按钮7细胞上的同一行含有pressed按钮的行需要复制
Every row contains 7 or so cells, and the 8th cell contains a shape with a macro attached to it (the button).When the user presses this button the 7 cells on the same row as the row containing the pressed button need to be copied.
使用ActiveCell是没有用的,因为pressing按钮实际上不设置单元格为活动。我四处搜寻了很多,但我似乎无法找到如何获取此值。
有一次我点击的按钮的行数我可以计算剩下的自己出去。
Using ActiveCell is of no use, since pressing the button doesn't actually set that cell as active. I searched around a lot but I can't seem to find how to obtain this value.Once I have the row number of the clicked button I can figure the rest out on my own.
推荐答案
每个图形
的 TopLeftCell
属性。它包含在其内的形状的左上角驻留的小区。
Each Shape
has TopLeftCell
property. It contains a cell within which the top left corner of the shape resides.
这篇关于Excel中VBA:越来越点击按钮的排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!