kingleviathan
Board Regular
- Joined
- Aug 23, 2010
- Messages
- 57
Hi Guys
I'm trying to write a real time/live command (not an on comman macro)....
I have a range of drop list....its possible to have more than one drop list selected even though the field itself may appear blank (by selecting a blank option)
Therefore I want to make sure that a max 1 (or 0) cells can be selected at one time.
For this reason =counta() is unsuitable as it will recognise drop boxes even they appear unselected.
Therefore I'm using this to count the blank cells
Range("Y1") = "=SumProduct((Len(D13:D18) = 0) * 1)"
I should be able to apply an if...then statement = ie..if there are 6 cells in range and 2 have been selected (therefore 4 or less cells are blank) then make all cells blank....
What am i doing wrong with below?
For Each cell In Range("D13:D18")
Range("Y1") = "=SumProduct((Len(D13:D18) = 0) * 1)"
' Count how many blank cells in range
If Range("Y1") <= 4 Then
'if 4 or less cell blank
Range("D13:D18").Value = " "
' make all cells in range blank
Range("y1").Value = "5"
'stops value going to 0 for next loop
End If
Next
I'm trying to write a real time/live command (not an on comman macro)....
I have a range of drop list....its possible to have more than one drop list selected even though the field itself may appear blank (by selecting a blank option)
Therefore I want to make sure that a max 1 (or 0) cells can be selected at one time.
For this reason =counta() is unsuitable as it will recognise drop boxes even they appear unselected.
Therefore I'm using this to count the blank cells
Range("Y1") = "=SumProduct((Len(D13:D18) = 0) * 1)"
I should be able to apply an if...then statement = ie..if there are 6 cells in range and 2 have been selected (therefore 4 or less cells are blank) then make all cells blank....
What am i doing wrong with below?
For Each cell In Range("D13:D18")
Range("Y1") = "=SumProduct((Len(D13:D18) = 0) * 1)"
' Count how many blank cells in range
If Range("Y1") <= 4 Then
'if 4 or less cell blank
Range("D13:D18").Value = " "
' make all cells in range blank
Range("y1").Value = "5"
'stops value going to 0 for next loop
End If
Next