How can I use numbers to define range for Max() ?

E

excel12345

I know the absolute offsets of the rows and columns in a seperate shee
and want to get the max of that range. For example:
=Max(CC, RR, cc, rr)

where all the parameters are numbers allowing me to define the range
 
G

Gary''s Student

Try:


Function mxinr(c1 As Long, r1 As Long, c2 As Long, r2 As Long) As Double
Dim r, rr As Range
Dim v As Double
Set r = Range(Cells(r1, c1), Cells(r2, c2))
v = Cells(r1, c1).Value
For Each rr In r
If rr.Value > v Then
v = rr.Value
End If
Next
mxinr = v
End Function
 
E

excel12345

Thanks to all of you for your help - I actually used a bit from each of
you and solved the problem and learned some valuable information at the
same time. Your time and effort in helping me is much appreciated.
 
Top