View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Birley Dave Birley is offline
external usenet poster
 
Posts: 171
Default Find Row from MAX expression

Waaal, shucks, I knew that (NOT!!!!!). Man do I have a lot to learn <g.
However you will be pleased to know that I have just completed reading (and
downloading) Chip Pearson's two excellent treatises on using Variables.

Thanks a million for your help on this one!
--
Dave
Temping with Staffmark
in Rock Hill, SC


"Tom Ogilvy" wrote:

Dim r as Range, res as Variant, r1 as Range

set r = rngCell.Resize(varcount + 1,1).offset(0,30)
varMaxSalary = Application.Max(varMaxSalary)
res = application.Match(varMaxSalary,r,0)
if not iserror(res) then
set r1 = r(res)
varMaxSalaryRow = r.row
else
varMaxSalaryRow = 1
End if

--
Regards,
Tom Ogilvy


"Dave Birley" wrote:

My objective is to select the row containing the highest value in a
particular column, copy the whole row and paste it in a different WS. I am
using this to find the MAX:

For i = 0 To varCount
varMaxSalary = Max(rngCell(1 + i, 29).Value, rngCell(2 + i,
29).Value)
Next i

..where varCount was earlier determined in a For Loop (SSNs), and rngCell is
selected in the outer For Loop..

What I think I want to do is add a line into this For Loop (or its
replacement) that defines varMaxSalaryRow. Problem is that varMaxSalary is a
Variant, not a Range, so I can't reference the Row from it as it is currently
defined.

Aaaaaargh!

Help, please?
--
Dave
Temping with Staffmark
in Rock Hill, SC