F
Faraz A. Qureshi
In the following code when the TST(Rng) function is applied upon four cells
simply (i.e. by Ctrl+Enter), while Rng selected for the same being cells not
equal to 4 in number, results into reappearing of a msgbox 4 times, unless
the function is applied as an array formula.
How to have the same presenting the message:
"Activecells' and the Selection's ranges should be of the Exactly Same Size."
be presented only once and TST returning a zero?
Function TST(Rng As Range)
Dim AR As Range
Set AR = Selection
If AR.Cells.Count <> Rng.Cells.Count Then
MsgBox "Activecells' and the Selection's ranges" & vbNewLine & _
" should be of the Exactly Same Size."
Exit Function
Else
TST = "OK"
End If
End Function
simply (i.e. by Ctrl+Enter), while Rng selected for the same being cells not
equal to 4 in number, results into reappearing of a msgbox 4 times, unless
the function is applied as an array formula.
How to have the same presenting the message:
"Activecells' and the Selection's ranges should be of the Exactly Same Size."
be presented only once and TST returning a zero?
Function TST(Rng As Range)
Dim AR As Range
Set AR = Selection
If AR.Cells.Count <> Rng.Cells.Count Then
MsgBox "Activecells' and the Selection's ranges" & vbNewLine & _
" should be of the Exactly Same Size."
Exit Function
Else
TST = "OK"
End If
End Function