Results 1 to 11 of 11

Find min 2 and max 2 cell values then highlight

Threaded View

  1. #1
    Registered User
    Join Date
    01-19-2009
    Location
    Las Vegas, NV
    MS-Off Ver
    Excel 2016
    Posts
    41

    Find min 2 and max 2 cell values then highlight

    I have searched, googled, and just can 't find the right code for this question, I hope someone can help me.

    I want to identify the 2 minimum valued greater than 0.00% in rows with percentages only. Then identify the 2 maximum values greater than 0.00% in rows with percentages only. The sheet changes in size (rows and columns) each day. C4 Row 4 is a constant starting place if that is necessary. I have been tweaking this code all night, but no luck. I keep getting a highlighted yellow error in editor @ oRg.Find(What:=iMin, _
    I also don't know what an oRg is, I am using 2001, that may be the problem.
    Please help...

    '   Sub FindMinValue()
    
        Dim oRg As Range, iMin As Variant
        Set oRg = Cells
        iMin = Application.Min(oRg)
        
        With oRg
        oRg.Find(What:=iMin, _
            After:=oRg.Range("A1"), _
            LookIn:=xlValues, _
            LookAt:=xlPart, _
            SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, MatchCase:=False _
            ).Select
        End With
        'Change selected cell format
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .ThemeColor = xlThemeColorAccent3
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
     
        'Displaying min value info
        With Selection
            MsgBox "Min value : " & iMin & vbCrLf & _
            "Cell position " & vbCrLf & _
            "Row : " & .Row & vbCrLf & _
            "Column : " & .Column
        End With
     
        End Sub
    Attached Files Attached Files
    Last edited by jpthelpguy; 01-26-2009 at 09:45 PM.

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