View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
QTE[_8_] QTE[_8_] is offline
external usenet poster
 
Posts: 1
Default Returning MAX value and MATCH position in specific cells

Hello Excel Forum.

Hi Greg,

Thank you so much for your assistance.

I have used virtually all of your procedure. However, I had to omi
the Rw declaration:

Rw = Range("F65536").End(xlUp).Row - removed line
Set Rng = Range("F4:F" & Rw) - removed & Rw

With the above statement in the procedure, it did not perform th
calculations or place them. It actually copied the total I had in th
last row (row18) of column F18 (subsequent row outside of my range) t
the equivalent adjacent last row in column G18 and then, added th
value in the last row of column E17 =14 to the value in the last row o
column F17=1 (included in my range) to make a sum value of 15 placed i
the last row (subsequent row outside of my range)of column H18.

So to summarise: the above statement put the values 26 and 15 in row 1
(the subsequent row to my range) of column G and H respectively.

I did not understand this line in its entirity:
Rw = Range("F65536").End(xlUp).Row

The value 65536, I believe is 16 to the power of 2?
Excel maximum sheet size is 16384 rows by 256 columns.
Visual Basic lets you allocate a string with a maximum length of 65,53
characters.

As you can see, I'm clutching at straws to understand the reference t
65536. If you have the time, would appreciate your insight.

The procedure does work excluding the Rw declaration and Se
statement.

Once again, Thank you.

Regards
QTE


Greg Wilson wrote:
*According to my understanding this is what you are looking
for. If you need to clear the previous results from
columns G and H then it is easy to do. I assume you know
how to do this. Hope it works.

Sub XXX()
Dim MaxVal As Double, Rng As Range
Dim Pos As Long, Rw As Long

Rw = Range("F65536").End(xlUp).Row
Set Rng = Range("F4:F" & Rw)
MaxVal = Application.Max(Rng)
Pos = Application.Match(MaxVal, Rng, 0)
Rng(Pos, 2) = MaxVal
Rng(Pos, 3) = Pos
End Sub

Regards,
Greg *[/B


--
Message posted from http://www.ExcelForum.com