I have a weekly grading spread sheet with 5 different categories in columns b, e, h, k, & n in which I create a new copy of the original sheet every week and enter a yes or no for that week. I want to compile all of these grades on a summary sheet so that sheet 1 counts the number of "y"s in sheets "sheet2" through "last" in each respective column. Then I can divide by the number of sheets in that range to get a percentage of y's entered in each column b, e, etc. I am pretty new to creating functions and using vba so I am really struggling.
The trickiest part is I would like the function to be able to accept the following arguments/parameters: which sheet to start counting at, which sheet to stop counting at, what to count (in this case y, but could change in my next workbook or if I add a new category), what cell to count from since I want to count a single cell on each sheet so that b7 is a compilation of only b7's on the range of sheets.
This was my feeble attempt:
Function mycountif(start As Variant, last As Variant, Cell As Variant, criteria As Variant) 'define name and parameters
Dim count As Integer
count = 0
For Each Worksheet In Worksheet.range(start, last)
count = count + Application.WorksheetFunction.CountIf(range(Cell), criteria)
Next Worksheet
mycountif = count
End Function
I'm new to the community so please let me know if there is anything else I need to clarify.
Thank you so much for any help you can lend.