Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Cell address

Hi!

How do I find the address of the cell that contains the minimum value in a
range.

Thanks in advance,

Neil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Cell address

In VBA? Assuming this is a 2-dim range rather than a single column or single
row,

Set Rng1 = Range("A1:K22")
x = Application.Min(Rng1)
Set Rng2 = Rng1.Find(What:=x, After:=Rng1.Cells(Rng1.Cells.Count))
MsgBox Rng2.Address


On Sat, 06 Nov 2004 22:49:31 GMT, "Neil" wrote:

Hi!

How do I find the address of the cell that contains the minimum value in a
range.

Thanks in advance,

Neil


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Cell address

Myrna,

Thanks for that, I just had to change it a little for my data to update a
chart and I was using a single row.

Set rng1 = Range(Cells(userrow, 19), Cells(userrow, 22))
x = Application.Min(rng1)
x1 = Application.Max(rng1)
With rng1
Set c = .Find(x, LookIn:=xlValues)
Set c1 = .Find(x1, LookIn:=xlValues)
End With
MinX = ActiveSheet.Range(c.Address).Address
MaxX = ActiveSheet.Range(c1.Address).Address

Thanks
Neil

"Myrna Larson" wrote in message
...
In VBA? Assuming this is a 2-dim range rather than a single column or
single
row,

Set Rng1 = Range("A1:K22")
x = Application.Min(Rng1)
Set Rng2 = Rng1.Find(What:=x, After:=Rng1.Cells(Rng1.Cells.Count))
MsgBox Rng2.Address


On Sat, 06 Nov 2004 22:49:31 GMT, "Neil" wrote:

Hi!

How do I find the address of the cell that contains the minimum value in a
range.

Thanks in advance,

Neil




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Cell address

These lines can be shortened
MinX = ActiveSheet.Range(c.Address).Address
MaxX = ActiveSheet.Range(c1.Address).Address

to
MinX = c.Address
MaxX = c1.Address

With a single row, I personally would use MATCH, like this:

Set Rng1 = Range(Cells(userrow, 19), Cells(userrow, 22))

x = Application.Min(Rng1)
MinX = Rng.Cells(Application.Match(x, Rng1, 0)).Address

x = Application.Max(Rng1)
MaxX = Rng.Cells(Application.Match((x, Rng1, 0)).Address


On Sun, 07 Nov 2004 03:56:03 GMT, "Neil" wrote:

Myrna,

Thanks for that, I just had to change it a little for my data to update a
chart and I was using a single row.

Set rng1 = Range(Cells(userrow, 19), Cells(userrow, 22))
x = Application.Min(rng1)
x1 = Application.Max(rng1)
With rng1
Set c = .Find(x, LookIn:=xlValues)
Set c1 = .Find(x1, LookIn:=xlValues)
End With
MinX = ActiveSheet.Range(c.Address).Address
MaxX = ActiveSheet.Range(c1.Address).Address

Thanks
Neil

"Myrna Larson" wrote in message
.. .
In VBA? Assuming this is a 2-dim range rather than a single column or
single
row,

Set Rng1 = Range("A1:K22")
x = Application.Min(Rng1)
Set Rng2 = Rng1.Find(What:=x, After:=Rng1.Cells(Rng1.Cells.Count))
MsgBox Rng2.Address


On Sat, 06 Nov 2004 22:49:31 GMT, "Neil" wrote:

Hi!

How do I find the address of the cell that contains the minimum value in a
range.

Thanks in advance,

Neil




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Cell address

Myrna,

Thanks a lot. It now works beautifully.

Neil

"Myrna Larson" wrote in message
...
These lines can be shortened
MinX = ActiveSheet.Range(c.Address).Address
MaxX = ActiveSheet.Range(c1.Address).Address

to
MinX = c.Address
MaxX = c1.Address

With a single row, I personally would use MATCH, like this:

Set Rng1 = Range(Cells(userrow, 19), Cells(userrow, 22))

x = Application.Min(Rng1)
MinX = Rng.Cells(Application.Match(x, Rng1, 0)).Address

x = Application.Max(Rng1)
MaxX = Rng.Cells(Application.Match((x, Rng1, 0)).Address


On Sun, 07 Nov 2004 03:56:03 GMT, "Neil" wrote:

Myrna,

Thanks for that, I just had to change it a little for my data to update a
chart and I was using a single row.

Set rng1 = Range(Cells(userrow, 19), Cells(userrow, 22))
x = Application.Min(rng1)
x1 = Application.Max(rng1)
With rng1
Set c = .Find(x, LookIn:=xlValues)
Set c1 = .Find(x1, LookIn:=xlValues)
End With
MinX = ActiveSheet.Range(c.Address).Address
MaxX = ActiveSheet.Range(c1.Address).Address

Thanks
Neil

"Myrna Larson" wrote in message
. ..
In VBA? Assuming this is a 2-dim range rather than a single column or
single
row,

Set Rng1 = Range("A1:K22")
x = Application.Min(Rng1)
Set Rng2 = Rng1.Find(What:=x, After:=Rng1.Cells(Rng1.Cells.Count))
MsgBox Rng2.Address


On Sat, 06 Nov 2004 22:49:31 GMT, "Neil"
wrote:

Hi!

How do I find the address of the cell that contains the minimum value in
a
range.

Thanks in advance,

Neil






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),QuoteNotes, sarah Excel Worksheet Functions 2 February 17th 09 02:59 PM
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),Range ... ? sarah Excel Worksheet Functions 0 February 17th 09 02:06 PM
Return cell address of a cell based on contents of cell. Danny Excel Worksheet Functions 4 November 15th 08 03:11 AM
find last cell in range with data, display cell address sevi61 Excel Worksheet Functions 14 October 29th 07 08:36 PM
How make hyperlink refer to cell content rather than cell address. Omunene Excel Discussion (Misc queries) 3 March 2nd 06 01:07 AM


All times are GMT +1. The time now is 01:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"