Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Finding max value

Fruits Mon Tues Wed Thurs Fri Sat Sun

Apple 1585 1122 1858 1989 1744 1992 989
Orange 2367 3312 1878 1066 1356 1878 2001
Watermelon 1001 1228 1355 1762 1882 1122 1311
Banana 1566 1788 1324 1333 1288 1671 1451
Mango 1021 1818 1613 1423 1902 1312 1515

Max 2367 3312 1878 1989 1902 1992 2001

I have used the following worksheet function to find the most no.of
fruits sold in each day.

MAX(B2:B6)
For e.g, On Monday, using the above function will give me value of
2367

I proceed on further to tell the worksheet to activate the cell that
contain the Max value using the below code:

Range("B:B").find(What:=[B7].Value).Activate


However, this only activate the cell that contains the value of 2367.
Is there a way to write a code which allows
the fruit which contains the max value of 2367 to be activate instead,
which in this case, the CEll "Orange"to be activate?


A million thanks !!! :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Finding max value

Hi,

Here is one method that activates Orange.

Sub Paradise()

Dim iRow As Integer

iRow = Range("B:B").Find(Application.Max(Range("B:B"))).R ow

Cells(iRow, 1).Select

End Sub

Hope this helps.

Regards,
Kevin





"paradise" wrote in message
om...
Fruits Mon Tues Wed Thurs Fri Sat Sun

Apple 1585 1122 1858 1989 1744 1992 989
Orange 2367 3312 1878 1066 1356 1878 2001
Watermelon 1001 1228 1355 1762 1882 1122 1311
Banana 1566 1788 1324 1333 1288 1671 1451
Mango 1021 1818 1613 1423 1902 1312 1515

Max 2367 3312 1878 1989 1902 1992 2001

I have used the following worksheet function to find the most no.of
fruits sold in each day.

MAX(B2:B6)
For e.g, On Monday, using the above function will give me value of
2367

I proceed on further to tell the worksheet to activate the cell that
contain the Max value using the below code:

Range("B:B").find(What:=[B7].Value).Activate


However, this only activate the cell that contains the value of 2367.
Is there a way to write a code which allows
the fruit which contains the max value of 2367 to be activate instead,
which in this case, the CEll "Orange"to be activate?


A million thanks !!! :)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding max value

Range("B:B").find(What:=[B7].Value).offset(0,-1).Activate

--
Regards,
Tom Ogilvy

paradise wrote in message
om...
Fruits Mon Tues Wed Thurs Fri Sat Sun

Apple 1585 1122 1858 1989 1744 1992 989
Orange 2367 3312 1878 1066 1356 1878 2001
Watermelon 1001 1228 1355 1762 1882 1122 1311
Banana 1566 1788 1324 1333 1288 1671 1451
Mango 1021 1818 1613 1423 1902 1312 1515

Max 2367 3312 1878 1989 1902 1992 2001

I have used the following worksheet function to find the most no.of
fruits sold in each day.

MAX(B2:B6)
For e.g, On Monday, using the above function will give me value of
2367

I proceed on further to tell the worksheet to activate the cell that
contain the Max value using the below code:

Range("B:B").find(What:=[B7].Value).Activate


However, this only activate the cell that contains the value of 2367.
Is there a way to write a code which allows
the fruit which contains the max value of 2367 to be activate instead,
which in this case, the CEll "Orange"to be activate?


A million thanks !!! :)



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
Finding the first value that is less than zero russhess8 Excel Worksheet Functions 4 June 25th 09 03:19 AM
Finding 1st,2nd,3rd etc checkQ Excel Discussion (Misc queries) 5 May 19th 08 12:38 AM
Finding the value of x bpiepkorn Excel Worksheet Functions 4 July 26th 07 04:02 PM
Finding last used mikefranklin1969 Excel Worksheet Functions 1 May 12th 06 10:05 PM
finding the "end" Julia New Users to Excel 2 September 1st 05 02:38 AM


All times are GMT +1. The time now is 06:49 PM.

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"