
Originally Posted by
p45cal
try:
Sub CountSEP()
Dim WS_Count As Integer
Dim I As Integer
Dim count As Integer
count = 0
WS_Count = ActiveWorkbook.Worksheets.count
For I = 1 To WS_Count
If InStr(ActiveWorkbook.Worksheets(I).Range("A5").Value, "Symantec Endpoint Protection : 12.1.5337.5000") > 0 Then count = count + 1
Next I
MsgBox count
End Sub
p45cal,
I am wondering how I can also show which sheets the value was found in. For instance, if I have 3 sheets (Computer1, Computer2, and Computer3) that all have "Symantec 12" listed in "A1", I would like to see output like "Computer1; Computer2; Computer3" in cell "B2" of the "Dashboard" sheet. My current code gives me "Dashboard; Dashboard; Dashboard; Dashboard; Dashboard" as output.
Here is my code:
Sub CountSEP()
Dim WS_Count As Integer
Dim I As Integer
Dim count As Integer
Dim shtName As String
count = 0
shtName = ActiveSheet.Name
WS_Count = ActiveWorkbook.Worksheets.count
For I = 1 To WS_Count
If InStr(ActiveWorkbook.Worksheets(I).Range("A1").Value, "Symantec 12") > 0 Then count = count + 1
shtName = shtName & "; " & ActiveSheet.Name
Next I
Sheets("Dashboard").Range("A2").Value = count
Sheets("Dashboard").Range("B2").Value = shtName
End Sub
I am using Microsoft Office 2010. I have attached the workbook I am testing from. I appreciate all of your help!testbook.xlsx