Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49948

Syntax For CountIf Using Variables

$
0
0
Hi, I cant figure out the syntax for CountIf, Im trying to add the following variables to countif, but I keep getting errors.

Thanks, much appreciated.

Code:

Sub ValleysDips()


 Dim ValuesRange As Range
 Dim ValuesRange As String
  Dim ResultCell As Range
  Dim CriteriaValue As String

  Set ValuesRange = Range("A1:A10")
  Set ResultCell = Range("C3")

  CriteriaValue = "A1"

  Range(ResultCell) = Application.WorksheetFunction.CountIf(Range(ValuesRange), "<" & Range(ResultCell))


End Sub

Attached Files

Viewing all articles
Browse latest Browse all 49948

Trending Articles