Thread: counting cells
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default counting cells

Hi Robert,

Private Sub UserForm_Activate()
tb1.Text =
CStr(WorksheetFunction.CountIf(Worksheets("Sheet1" ).Range("A:A"), 2))
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Robert Couchman" wrote in message
...
Hello all,

i am curently looking for a piece of code that will look
at all cells in a column and count the number of cells
that contain the value "2" then display this result in my
textbox on a form "tb1"

this is to be used for stats so i will need this in VB
form as it will need to be updated every time stats is run.

Thank you,

Robert Couchman
)