Hi, I want to count the number of selected cells in a range, then convert them to a value of 0 and 1.
So far, the code I can work with is like this. but the results are not as expected
Thank you in advance
A | B | C | D | E | F | G | |
1 | Data 1 | Data 2 | Data 3 | Data 4 | Result | ||
2 | Apple | Banana | 1100 | ||||
3 | Orange | Lemon | 0101 | ||||
4 | Grape | 0010 |
So far, the code I can work with is like this. but the results are not as expected
VBA Code:
Function Tot(RR As Range)
Dim cell As Range
Tot = "0"
For Each cell In RR
If cell.Value = "" Then
Tot = Tot & 1
End If
Next cell
End Function
Thank you in advance