View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default Countif a Name occures in a column

Sub CountName ()
Dim numname as Long
Dim namerng as Range

Set namerng as Sheets("Sheet1").Range("A1:A100") 'where your list of
names are located
numname = Application.WorksheetFunction.Countif("Name", namerng)
Sheets("Sheet1").Range("B1"). Value = numname 'puts answer on sheet
End Sub

Mike F
"Tempy" wrote in message
...
Hi all,

I need to count the number of time a name appears in a column and then
save the amount in a cell.

I would like to do this with code as i manipulate the spreadsheet.
I have done it with a countif formular in the cell, nut must one do this
? or is it better to store the total as a variable and then past the
variable into the cell, it is the latter that i am not sure how to do.

Thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***