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

Samsung Galaxy A8 review: Hands-on

Illustrator Juan Esteban Rodriguez on creating highly detailed official film posters for Star Wars…

iMac Pro review

Comment savoir si quelqu'un a bloqué votre numéro de téléphone ?