作者:小攸罗曼史 | 来源:互联网 | 2023-05-18 17:21
Ihaveassignedmacrotofewbuttons.我已经将宏分配给几个按钮。HowcanIfindoutinsidemacrowhichbuttonw
I have assigned macro to few buttons.
我已经将宏分配给几个按钮。
How can I find out inside macro which button was clicked?
如何在内部宏中查找单击了哪个按钮?
I am doing as user form, where he can input peoples from family:
我以用户形式做,他可以从家庭输入人:
name1:
surname1:
name1:surname1:
name2:
surname2: |add next member|
name2:surname2:|添加下一个成员|
I wish button to appear always in last row of the last added person. For simplicity I think it is better to have like 100 empty forms in the sheet but all invisible at the begining.
Then when user clicks add next member I simply make next rows visible, and move button to next person. But to do that I need to know my current position.
我希望按钮始终显示在最后添加的人的最后一行中。为简单起见,我认为最好在表格中有100个空表格,但在开头时都是不可见的。然后当用户点击添加下一个成员时,我只需将下一行显示为可见,然后将按钮移动到下一个人。但要做到这一点,我需要知道我目前的立场。
Similar with deletion I would make rows invisible when remove button is clicked.
与删除类似,当单击删除按钮时,我会使行不可见。
name1:
surname1: [remove]
name1:surname1:[删除]
name2:
surname2: [remove]
name2:surname2:[删除]
name3:
surname3: |add next member|
name3:surname3:|添加下一个成员|
I need to know which remove button was clicked.
我需要知道点击了哪个删除按钮。
EDIT: Found in web - what do you think, seems to be best /way
编辑:发现在网络 - 你怎么想,似乎是最好的/方式
Dim r As Range
Set r = ActiveSheet.Buttons(Application.Caller).TopLeftCell
Range(Cells(r.Row, r.Column), Cells(r.Row, r.Column)).Select
4 个解决方案