EXCEL count string within matrix ??

  cga 13:05 17 Aug 2004

I don't know if anyone can help me with this?

I have a number of sheets, each of which has 64 rows and 16 columns. The cells contain 6 character text values (actually they are volume labels).

What I would like to do is count the number of cells where the text value starts with a specific 3 characters.

Can anyone help me with a macro for this please?

Thanks in advance

  VoG II 13:19 17 Aug 2004

You will need to run this on each sheet in turn.

Sub test2()

Dim iCol As Integer, iRow As Integer, findme As String, kount

kount = 0

findme = "aaa"

For iCol = 1 To 16

For iRow = 1 To 64

If Left(Cells(iRow, iCol).Value, 3) = findme Then kount = kount + 1

Next iRow

Next iCol

MsgBox ("Found " & kount & " instances")

End Sub

  cga 13:25 17 Aug 2004

Brilliant - I will give that a go but it looks fine. Thanks

  cga 13:57 17 Aug 2004

Works well & saved me a lot of time - Thanks.

This forum is the tops.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Alienware 17 R4 2017 review

Illustrator Sylvain Tegroeg created thousands of intricate line drawings for the mobile game…

Best iPad buying guide 2017

Comment télécharger une application indisponible en France ?