OleMiss2010
Member
I am creating a workbook that will hold many worksheets and have a summary page at the front. I found and slightly augmented a UDF to count some components from the worksheets and put them in the summary tab. However, the UDF requires that I list out all of the worksheets that it is searching (see below).
Public Function CntIf3D(rng As Range, V As Variant, ParamArray arglist() As Variant)
Application.Volatile
CntIf3D = 0
For Each arg In arglist
CntIf3D = WorksheetFunction.CountIf(Sheets(arg).Range(rng.Address), V) + CntIf3D
Next
End Function
I have a macro that will put the function in a desired cell. The macro currently says:
"=CntIf3D(R3C2,""<>"",""Worksheet"",""Worksheet1"",""Worksheet2"")"
How can I essentially replace ""Worksheet"",""Worksheet1"",etc. with something like "Every Worksheet in Sheets" and make the function work?
Public Function CntIf3D(rng As Range, V As Variant, ParamArray arglist() As Variant)
Application.Volatile
CntIf3D = 0
For Each arg In arglist
CntIf3D = WorksheetFunction.CountIf(Sheets(arg).Range(rng.Address), V) + CntIf3D
Next
End Function
I have a macro that will put the function in a desired cell. The macro currently says:
"=CntIf3D(R3C2,""<>"",""Worksheet"",""Worksheet1"",""Worksheet2"")"
How can I essentially replace ""Worksheet"",""Worksheet1"",etc. with something like "Every Worksheet in Sheets" and make the function work?