been trying this for a while but any way that i think of doing it i get errors. i would thing that this would be easy so changes are it is right in front of my face and i just don't know how to do it. this is what i have so far:

Sub notsureagooodname()

Dim lastrow As Long

'find last row

With Sheets("DATA")

If Application.WorksheetFunction.CountA(.Cells) <> 0 Then

lastrow = .Cells.Find(What:="*", _

After:=.Range("A1"), _

Lookat:=xlPart, _

LookIn:=xlFormulas, _

SearchOrder:=xlByRows, _

SearchDirection:=xlPrevious, _

MatchCase:=False).Row

Else

lastrow = 1

End If

End With

MsgBox lastrow

'running through data

Dim x As Integer

Dim count As Long

x = 2176

Dim rngTarget As Range

Dim rngSearched As Range

For Each rngTarget In Sheets("DATA").Range("D1:D" & lastrow)

If Sheets("DATA").Range("D" & rngTarget) = x Then

count = count + 1

End If

Next rngTarget

MsgBox count

End Sub

i am guessing that i am not using the range function right, but idk. if someone could not only show me how to get this working but tell me what i am doing wrong that would be great.