Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),QuoteNotes, | Excel Worksheet Functions | |||
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),Range ... ? | Excel Worksheet Functions | |||
Return cell address of a cell based on contents of cell. | Excel Worksheet Functions | |||
find last cell in range with data, display cell address | Excel Worksheet Functions | |||
How make hyperlink refer to cell content rather than cell address. | Excel Discussion (Misc queries) |