EXCEL count string within matrix ??

  cga 13:05 17 Aug 04

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 04

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 04

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

  cga 13:57 17 Aug 04

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.

LG G6 review: Hands-on with LG’s bold, big-screen shot at perfection

1995-2015: How technology has changed the world in 20 years

How the painting-like animated sequences in A Monster Calls were created by Glassworks Barcelona

The 22 best Safari extensions | Best Safari plugins: Improve Apple's Safari web browser with these…