[英]Delete n% of the rows from the excel sheet on click of the button using VBA or any excel formula if possible
[英]VBA to click a button in a excel sheet
我需要单击 Excel 工作表上的按钮(FormControl)并通过 VBA 代码运行分配给它的宏。
我尝试了这里的建议https://stackoverflow.com/questions/130166/clicking-command-button-from-other-workbook但它对我不起作用。
有没有其他方法可以做到这一点?
执行此操作的相当简单的方法,即使它没有真正记录在案。
CommandButton1.Value = True
你真的尝试了吗? 因为您想要精确地建议那里的内容。
Application.Run Activesheet.Shapes(1).OnAction
如果在工作表中。 我过去用过这个,它奏效了!
Sheet1.CommandButton1_Click
别的
Sheets("Sheet Name").CommandButton1_Click
就我而言,我需要在 Sheet1 上添加一个按钮,以在 Sheet2 上调用 CommandButton1 的代码。 首先,我必须删除位于 CommandButton1_Click() 前面的“Private”语句。 然后我不得不在调用 Worksheets("Sheet2").CommandButton1_Click 之前调用 Worksheets("Sheet2").Activate。 然后它起作用了。 然后,您可以添加 Worksheets("Sheet1").Activate 以返回到原始工作表。 所以:
Private Sub CommandButton1_Click()
Worksheets("Sheet2").Activate
Worksheets("Sheet2").CommandButton1_Click
Worksheets("Sheet1").Activate
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.