如何将按钮文本动态传递给 vba 函数
How to pass the button text dynamically to a vba function
如何将按钮文本动态传递给 vba 函数?
例如,我有一个带有文本 ''
的按钮
Sub Status()
Dim ButtonText As String
With ActiveSheet.UsedRange
.AutoFilter 3, "=<button-text>"
End With
End Sub
对于表单按钮:
Sub Status()
Dim shp As Shape, ButtonText As String
Set shp = ActiveSheet.Shapes(Application.Caller)
ButtonText = shp.OLEFormat.Object.Caption
ActiveSheet.UsedRange.AutoFilter 3, "=" & ButtonText
End Sub
如何将按钮文本动态传递给 vba 函数? 例如,我有一个带有文本 ''
的按钮Sub Status()
Dim ButtonText As String
With ActiveSheet.UsedRange
.AutoFilter 3, "=<button-text>"
End With
End Sub
对于表单按钮:
Sub Status()
Dim shp As Shape, ButtonText As String
Set shp = ActiveSheet.Shapes(Application.Caller)
ButtonText = shp.OLEFormat.Object.Caption
ActiveSheet.UsedRange.AutoFilter 3, "=" & ButtonText
End Sub