Thread: count data
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default count data

Hi,
Something along these lines ....

Sub x()

Dim r As Long
Dim rng As Range

For r = 2 To 10 ' Loop through rows .....
lastcol = Cells(r, Columns.Count).End(xlToLeft).Column
Set rng = Range(Cells(r, 1), Cells(r, lastcol))
If Application.CountIf(rng, "window") 0 And Application.CountIf(rng,
"open") Then
MsgBox "Add my code"
' increment your count ....
End If
Next r

End Sub

HTH

"diesel" wrote:

if and if only two difrent data are found in cells on the same raw will be
counted if not will move to the next raw and so on

like the word "window" and the word "open" are found on the same raw it will
be counted if not it wil move to the next raw and so on how can it be done

then ill get the number of times that these data were found togather in
single raw in the data sheet