View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default a count function

Select you range and run:

Sub Mfindit()
Dim r As Range
Dim i As Long
Dim V As Integer
i = 0
V = InputBox("search value")
For Each r In Selection
If r.Value = V Then
MsgBox "found number in column " & r.Column & " row " & r.Row
i = i + 1
End If
Next
MsgBox "total found= " & i
End Sub

--
Gary''s Student


"M" wrote:

I would like to code this :
within a range of cells, containing numbers, I would like to find out :
* how many
* at which location
a given number is located.

Example in which cell(s) is number "56" stored for the following cell values
: 12 456 78541 56 1562

--- 3 times : in cell 2, 4 and 5.

Thanks for the code