Here's something that has been giving me fits.
In my work book, if I use the following in a cell, I get a count of all cells in the range that are populated:
Count(C22,F22,I22,L22,O22)
I am trying to do this in vba:
With the same selection, the VBA code returns "#Value!"
I assume it's not liking my range selection?
If I do this the code works:
If I want to be able to select more than a specified number of cells, how would I code that?
In my work book, if I use the following in a cell, I get a count of all cells in the range that are populated:
Count(C22,F22,I22,L22,O22)
I am trying to do this in vba:
Code:
Public Function No_Conditions(M_Range As Range)
No_Conditions = WorksheetFunction.count(M_Range)
End Function
With the same selection, the VBA code returns "#Value!"
I assume it's not liking my range selection?
If I do this the code works:
Code:
Public Function No_Conditions(Cond1, Cond2, Cond3, Cond4, Cond5)
No_Conditions = WorksheetFunction.count(Cond1, Cond2, Cond3,
End Function
If I want to be able to select more than a specified number of cells, how would I code that?