ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calculate Min and Max Values of selection (https://www.excelbanter.com/excel-programming/325451-calculate-min-max-values-selection.html)

bandy2000

calculate Min and Max Values of selection
 
HI
I have a range selected as following:

Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1, 0)).Select

How can I do calculations with the data in that selection e.g. get the Min
or Max Value or the Mean Value? Those are all available in Excel. How can I
make them available programatically?
Is it possible to store the result in a different worksheet? How?

Thanks


Don Guillett[_4_]

calculate Min and Max Values of selection
 
try
msgbox application.min(range("b2:b22"))

--
Don Guillett
SalesAid Software

"bandy2000" wrote in message
...
HI
I have a range selected as following:

Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1, 0)).Select

How can I do calculations with the data in that selection e.g. get the Min
or Max Value or the Mean Value? Those are all available in Excel. How can

I
make them available programatically?
Is it possible to store the result in a different worksheet? How?

Thanks




Bob Phillips[_6_]

calculate Min and Max Values of selection
 
Msgbox Application.MAX(Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix -
1, 0)))

ertc.
to store in a different worksheet

Worksheets("Sheet2").Range("A1").VAlue = Application.MAX( ...

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bandy2000" wrote in message
...
HI
I have a range selected as following:

Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1, 0)).Select

How can I do calculations with the data in that selection e.g. get the Min
or Max Value or the Mean Value? Those are all available in Excel. How can

I
make them available programatically?
Is it possible to store the result in a different worksheet? How?

Thanks




bandy2000

calculate Min and Max Values of selection
 
Thanks for the hints. What I have done now is:
Set SelectedRange = Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1, 0))
Minimum = Application.WorksheetFunction.Min(SelectedRange)
MsgBox "Minimum= " & CStr(Minimum)

How can I make the Argument for Range (here "A1") in
Worksheets("Sheet2").Range("A1").VAlue = Minimum
depending to a variable so that I could for instance use a for loop and make
the
cell where the value is written to depending to counting variable i ?

"Bob Phillips" wrote:

Msgbox Application.MAX(Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix -
1, 0)))

ertc.
to store in a different worksheet

Worksheets("Sheet2").Range("A1").VAlue = Application.MAX( ...

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bandy2000" wrote in message
...
HI
I have a range selected as following:

Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1, 0)).Select

How can I do calculations with the data in that selection e.g. get the Min
or Max Value or the Mean Value? Those are all available in Excel. How can

I
make them available programatically?
Is it possible to store the result in a different worksheet? How?

Thanks





Bob Phillips[_6_]

calculate Min and Max Values of selection
 
Worksheets("Sheet2").Cells(row_num,col_num).Value = Minimum


--

HTH

RP
(remove nothere from the email address if mailing direct)


"bandy2000" wrote in message
...
Thanks for the hints. What I have done now is:
Set SelectedRange = Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1,

0))
Minimum = Application.WorksheetFunction.Min(SelectedRange)
MsgBox "Minimum= " & CStr(Minimum)

How can I make the Argument for Range (here "A1") in
Worksheets("Sheet2").Range("A1").VAlue = Minimum
depending to a variable so that I could for instance use a for loop and

make
the
cell where the value is written to depending to counting variable i ?

"Bob Phillips" wrote:

Msgbox Application.MAX(Range(ActiveCell,

ActiveCell.Offset(NumMeasPerPix -
1, 0)))

ertc.
to store in a different worksheet

Worksheets("Sheet2").Range("A1").VAlue = Application.MAX( ...

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bandy2000" wrote in message
...
HI
I have a range selected as following:

Range(ActiveCell, ActiveCell.Offset(NumMeasPerPix - 1, 0)).Select

How can I do calculations with the data in that selection e.g. get the

Min
or Max Value or the Mean Value? Those are all available in Excel. How

can
I
make them available programatically?
Is it possible to store the result in a different worksheet? How?

Thanks








All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com