Hi ,
I have multiple workbooks with 100's to 200's sheets in which I want to count number of entries of A2:A10000 range has, if the cell C2:C10000 has some value then only count should be considered else Not to be considered. This value should be stored in V2 cell of each sheet
Similarly, I want in cell W2, of each sheet I want to count number of entries of A2:A10000 range has, if the cell C2:C10000 has some No-Value then only count should be considered else Not to be considered.
Also, if possible in first sheet, I wanted consolidated grand total of cells value of V2 and W2 across all the sheets.
I tried below VBA code with no luck it prints 0 under V2 and W2 cells. any help is much appreciated.
Sub test()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
ws.Range("V1").Value = "Rules with Action"
ws.Range("W1").Value = "Rules without Action"
ws.Range("V2") = WorksheetFunction.CountIfs(Range("F2:F5000"), " <> ", Range("M2:M5000"), " <> ")
ws.Range("W2") = WorksheetFunction.CountIfs(Range("F2:F5000"), " <> ", Range("M2:M5000"), "")
End With
Next ws
End Sub
I have multiple workbooks with 100's to 200's sheets in which I want to count number of entries of A2:A10000 range has, if the cell C2:C10000 has some value then only count should be considered else Not to be considered. This value should be stored in V2 cell of each sheet
Similarly, I want in cell W2, of each sheet I want to count number of entries of A2:A10000 range has, if the cell C2:C10000 has some No-Value then only count should be considered else Not to be considered.
Also, if possible in first sheet, I wanted consolidated grand total of cells value of V2 and W2 across all the sheets.
I tried below VBA code with no luck it prints 0 under V2 and W2 cells. any help is much appreciated.
Sub test()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
ws.Range("V1").Value = "Rules with Action"
ws.Range("W1").Value = "Rules without Action"
ws.Range("V2") = WorksheetFunction.CountIfs(Range("F2:F5000"), " <> ", Range("M2:M5000"), " <> ")
ws.Range("W2") = WorksheetFunction.CountIfs(Range("F2:F5000"), " <> ", Range("M2:M5000"), "")
End With
Next ws
End Sub