Compare values of cells in a range
The following Sub calls your Function with the rng set,
but not "selected", by an InputBox. It could be set in
other ways as well.
Public Sub FindMax()
Dim str1 As String
Dim rng As Range
str1 = InputBox("Enter range of cells, e.g. A1:A10.")
Set rng = Range(str1)
Debug.Print fnCompCells(rng)
End Sub
Hth,
Merjet
|