View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 618
Default find 10 max values in different sheets

Hi Bandy

application.large
IMHO should read
Application.WorksheetFunction.Large
likewise for application.small

however, i don't think this is going to solve your problem

what are the worksheets and ranges that you want to look for the 10min / 10
max values in, will these change over time?

Cheers
JulieD



"bandy2000" wrote in message
...
Hi,

I have following code:

Sub MarkTheCells(SelRange As Range, worksheetname As String)
Dim l As Double, s As Double
Dim cell, SortRange As Range
Dim pos As Integer
Dim CellRow, CellCol As Long


pos = 0
SelRange.Interior.ColorIndex = xlNone
l = Application.Large(SelRange, 10)
s = Application.Small(SelRange, 10)
For Each cell In SelRange
If IsNumeric(cell) And _
Not IsEmpty(cell) And cell.Text < "" Then
If cell.Value = l Then
CellRow = cell.Row
CellCol = cell.Column
cell.Interior.ColorIndex = 3
Worksheets(worksheetname).Range("A1").Offset(20 + pos, 4).Value
=
cell.Value
Worksheets(worksheetname).Range("A1").Offset(20 + pos, 3).Value
=
Range("A1").Offset(CellRow - 1, 0).Value
Worksheets(worksheetname).Range("A1").Offset(20 + pos, 2).Value
=
Range("A1").Offset(0, CellCol - 1).Value
pos = pos + 1
ElseIf cell.Value <= s Then
cell.Interior.ColorIndex = 5
End If
End If
Next



End Sub



This should select the 10 max and 10 min values in a selected range. It
should be possible to call it for different worksheets. But I get problems
with the Application.Large function. I can't find information on the
Application Methods.
Does anybody have an idea what to change in order to make this code work?
ANDY