I need a little (lot) help here with this code. I'm not sure why I'm getting a 400 alarm when I run this. I'm trying to count the number of values in a range that I think I defined but I'm not sure. Then I want to put that variable in a message box. I borrowed some of this from a book that I found but it's an older version of VBA. I think it's for a Commadore 64 sp??
Sub find_value()
Dim myrange As Range
Dim count As Integer
count = 0
latrow = Cells(1, 1).End(xlDown).Row
myrange = Range(Cells(1, 1), Cells(lastrow, 1)).Address
For Each C In myrange
If C.Value = 5 Then
count = count + 1
End If
Next C
MsgBox "There are " & C & " entries found"
End Sub
I may not be very smart but I'm sure wirey!!!!
Sub find_value()
Dim myrange As Range
Dim count As Integer
count = 0
latrow = Cells(1, 1).End(xlDown).Row
myrange = Range(Cells(1, 1), Cells(lastrow, 1)).Address
For Each C In myrange
If C.Value = 5 Then
count = count + 1
End If
Next C
MsgBox "There are " & C & " entries found"
End Sub
I may not be very smart but I'm sure wirey!!!!