+ Reply to Thread
Results 1 to 9 of 9

find n highlight max value

Hybrid View

only_lonely find n highlight max value 05-21-2007, 03:50 AM
sweep Hi, This code will turn... 05-21-2007, 04:14 AM
only_lonely where to insert the code?... 05-21-2007, 04:27 AM
sweep No worries, With your... 05-21-2007, 04:36 AM
only_lonely thanks...it works preety 05-21-2007, 04:52 AM
  1. #1
    Registered User
    Join Date
    08-24-2006
    Posts
    61

    find n highlight max value

    I have

    A
    1 2.22
    2 2.23
    3 2.33
    4 1.44
    5 3.44

    at A6 i putting the formula to find out the max value at A
    =MAX(A1:A5)
    which is = 3.44

    My question is
    how to make the system highlited the max value for me
    I mean, highlight the cell A5 after find out it is the max value.
    So that i know where is the max value located.
    Because i have thousands of numbers...which make me headache to find it out

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Hi,

    This code will turn the maximum in a selected range green

    Sub highlightmax()
    Dim rcell As Range
    Dim rrange As Range
    Dim maxm As Variant
    Set rrange = Selection
    maxm = Application.WorksheetFunction.max(rrange)
    
    For Each rcell In rrange
    If rcell.Value = maxm Then
    rcell.Interior.ColorIndex = 4
    End If
    Next
    End Sub
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    08-24-2006
    Posts
    61
    where to insert the code?
    sorry..

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    No worries,

    With your workbook open, press ALT & F11 to open the VB editor

    Go to Insert > Module

    paste the code into the window that appears.

    Close the VB editor.

    In your workbook, highlight the range in which you want the highlight to appear, then go to Tools>Macro>Run Macro, and select highlightmax

    Dave

  5. #5
    Registered User
    Join Date
    08-24-2006
    Posts
    61
    thanks...it works preety

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,346
    alternatively, you could use conditional formatting. Format->Conditional formatting._> formula is =A1=$A$6->Set format.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1