ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   counting cells (https://www.excelbanter.com/excel-programming/292472-counting-cells.html)

Robert Couchman[_4_]

counting cells
 
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
)

Bob Phillips[_6_]

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
)




Robert Couchman[_4_]

counting cells
 
Cheers Bob,

Code worked perfect, now i actually have a working stats
sheet!

Thankyou,

Robert Couchman
)


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com