通过按钮执行VBA代码

时间:2017-01-15 10:29:46

标签: excel vba excel-vba

我想将以下VBA代码分配给按钮。这就是我所做的:

1.点击开发者选项和"插入"   2.插入 - >表单控件 - >按钮。   3.当它提示我选择一个宏时,我选择了我的代码......它是WBR。   但是当我点击它时,它没有执行(也没有错误)

我不确定导致问题的原因。

我的代码非常庞大,所以只提供样本:

Sub WBR()

Dim Count1Criteria As Variant
Dim Count3Criteria As Variant
Dim test As Variant
Dim wf As WorksheetFunction
Set wf = Application.WorksheetFunction



Filter1InSummary = Array(Array("AH4", "Latency", "Pass/Fail", "Pass"), _
                         Array("AH5", "Latency", "Pass/Fail", "Fail"), _
                         Array("AH44", "TT", "Able to repro", "Not Tested"), _
                         Array("AH47", "TT", "Reason for Reasssignment/Resolving", "Duplicate TT"), _
                         Array("AH51", "TT", "Able to repro", "Yes"), _
                         Array("AH52", "TT", "Able to repro", "No"), _
                         Array("AH61", "Reactive", "Item Type", "Item"), _
                         Array("AH46", "TT", "Reason for Reasssignment/Resolving", "Hardware Unavailable"), _
                         Array("AH41", "TT", "Severity", "2"), _
                         Array("AH62", "Reactive", "Trigger Key Name", "*App Crashes*"), _
                         Array("AH63", "Reactive", "Trigger Key Name", "*Download*"), _
                         Array("AH49", "TT", "Reason for Reasssignment/Resolving", "Insufficient Information"), _
                         Array("AH15", "Latency", "Comments", "*Waived since unable to repro issue*"), _
                         Array("AH16", "Latency", "Comments", "*Waived due to business reasons*"), _
                         Array("AH18", "Non-Mhowls", "Type of testing", "Full Testing"), _
                         Array("AH19", "Non-Mhowls", "Type of testing", "Upgrade Testing"))




 For Each test In Filter1InSummary
    With Worksheets(test(1))
        Range(test(0)) = wf.CountIfs(.Rows(1).Find(test(2), lookat:=xlWhole).EntireColumn, test(3))
    End With
    Next

0 个答案:

没有答案