Runtime error 13 Type mismatch or compile error

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
626
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
VBA Code:
 Worksheets("Work Orders").Activate
    
'**********************************************************************************************************************************
    'Totals ALL Processing Work Orders
    Me.Label15.Caption = Application.WorksheetFunction.CountIf(Range("L:L"), "TPM Processing Technician (P4TPMPRO)")
    'Totals Closed Processing Work Orders
    Me.Label31.Caption = Application.WorksheetFunction.CountA(Filter("A:A", ("L:L" = "TPM Processing Technician (P4TPMPRO)") * ("R:R" = "Technically completed")))
'----------------------------------------------------------------------------------------------------------------------------------

Runtime error 13 Type mismatch occurs
VBA Code:
 Me.Label31.Caption = Application.WorksheetFunction.CountA(Filter("A:A", ("L:L" = "TPM Processing Technician (P4TPMPRO)") * ("R:R" = "Technically completed"))))

So I then tried change the code to the following and still received the same error:
VBA Code:
 Me.Label31.Caption = Application.WorksheetFunction.CountA(Filter(Range("A:A"), Range("L:L") = "TPM Processing Technician (P4TPMPRO)") * Range("R:R" = "Technically completed"))

Thank you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
There's a plural version of COUNTIF. Try:
VBA Code:
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Work Orders")

Me.Label31.Caption = Application.WorksheetFunction.CountIfs( _
    ws.Range("L:L"), "TPM Processing Technician (P4TPMPRO)", _
    ws.Range("R:R"), "Technically completed")
 
Upvote 0
For your code to work, try...

VBA Code:
    With Application.WorksheetFunction
        Me.Label31.Caption = .CountA(.Filter(Range("A:A"), Evaluate("(L:L=""TPM Processing Technician (P4TPMPRO)"")*(R:R=""Technically completed"")")))
    End With

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top