我想使用CountIf
函数,但是如果我的任何一个变量(a或B)都是空白(userform组合框没有用值选择),则该函数不会计算。下面列出的是CountIfs
函数。我想忽略" D"变量如果为空且仍为Countif
。
Public Sub CommandButton1_Click()
Dim C As String
Dim LastTarget As range
Dim LastTarget2 As range
Set LastTarget = ActiveCell
Set LastTarget2 = ActiveCell.Offset(0, 3)
Set wb1 = Workbooks("Userform 4.3.xlsm")
a = ComboBoxA.value
B = ComboBox1.value
'Counts & Coverages based on plan code selection
LastTarget = Application.CountIfs(wb1.Sheets("Carrier").range("BG:BG"), a, wb1.Sheets("Carrier").range("AH:AH"), B)
卸载我
End Sub