Sub CountJEF()
Dim a, x, num As Integer
a = 1
'Copie the names from sheet1 to sheet3 (where the results are showed)
Worksheets("sheet1").Select
Range("A1", Range("A" & Rows.Count)).Copy Worksheets("sheet3").Range("A1")
'Making a loop to count JEF in 1 sheet
x = Range("A1").CurrentRegion.Rows.Count - 1
For Row = 0 To x
num= Application.CountIf(Rows(a), "JEF")
Sheets("Test2").Range("B1").Offset(Row, 0).Value = Num
a = a + 1
Next
End Sub
This works, the right results are showed
Sub CountJEF()
Dim a, x, num As Integer
a = 1
'Copie the names from sheet1 to sheet3 (where the results are showed)
Worksheets("sheet1").Select
Range("A1", Range("A" & Rows.Count)).Copy Worksheets("sheet3").Range("A1")
'Making a loop to count JEF in 2 sheet
x = Range("A1").CurrentRegion.Rows.Count - 1
For I = 1 to 2
For Row = 0 To x
num= Application.CountIf(Sheets(I).Rows(a), "JEF")
Sheets("Test2").Range("B1").Offset(Row, 0).Value = Num
a = a + 1
Next
Next I
End Sub
This doesn't work, all the results are 0
I hope this is enough information
Bookmarks