AdMac
AdMac

Reputation: 127

Countif is not working across worksheet

I'm trying to use VBA to define a variable off of the number of occurances happening in a single column on a different worksheet. I'm trying to count the number of times "Underwriting" appears in column S.

I'm getting a Run-time error '438' - object doesn't support this property or method.

Can anyone tell me what I'm doing wrong?

The error points me to the line beginning with "piperow = ...

Sub Resize_Template()

Dim pipeRow As Long

pipeRow = ActiveWorkbook.Sheets("Pipeline - Underwriting Data D").countif(Range("S:S"), "Underwriting")

End Sub

Thanks for any help!

Upvotes: 0

Views: 315

Answers (1)

Scott Craner
Scott Craner

Reputation: 152660

You need to use Application.WorksheetFunction.

pipeRow = Application.WorksheetFunction.Countif(ActiveWorkbook.Sheets("Pipeline - Underwriting Data D").Range("S:S"), "Underwriting")

Upvotes: 1

Related Questions