Description
1 The first sheet named Sheet1, and the second named step
22 sheet comparison, if the same, put the number of files in the second column of Sheet1
Sub countstep () ' Countstep Macro ' keyboard shortcut:ctrl+shift+t Dim sheetycnt As Integer Dim stepycnt As Integer Dim sheetname As String Dim stepname As String sheetname = "Sheet1" ' result page name stepname = ' Step ' result from Pag E Name sheetycnt = Worksheets (sheetname). UsedRange.Rows.Count stepycnt = Worksheets (stepname). UsedRange.Rows.Count for i = 1 to sheetycnt Dim fileName as String ' read ' column 1 of the result page filename = Worksheets (sheetname). Cells (i, 1). Value Dim k as Integer k = 0 for j = 1 to stepycnt Dim fullName As String Dim lastword As Stri Ng Dim Index as Integer fullName = Worksheets (stepname). Cells (J, 1). Value ' read column 1 of result from page ' substr String from last ' \ ' to end index = InStrRev (FullName, "
\ ") Lastword = Mid (fullName, index + 1) If FileName = Lastword Then k = k + 1 ' Column 5 (result from page)-> column 1 (Result page) worksheets (sheetname). Cells (i, 2).
Value = K End If Next next MsgBox ' End ' End Sub