I am trying to get the cell address of the min value in a range I am getting a Run-time error 424 Object required. The error is highlighted in yellow at the Set minCell line.
Any help is appreciated.
Any help is appreciated.
Code:
Sub LowHighUpdate1()
Dim ws As Worksheet
Dim wrksh As Excel.Worksheet
Dim R1 As Long
Dim LR As Long
Dim minRng As Range
Dim maxRange As Range
Dim minCell As Range
Dim maxCell As Range
Dim lMin As Long
Dim lMax As Long
For Each wrksh In Sheets
Select Case wrksh.Name
Case "Parameters"
GoTo Skip
Case Else
wrksh.Select
LR = wrksh.Range("A" & Rows.Count).End(xlUp).Row
For R1 = 7 To LR
Set minRng = Range("D" & R1 & ":D" & (R1 - 5))
lMin = Application.WorksheetFunction.Min(minRng)
[YELLOW] Set minCell = minRange.Find(minRng) [/YELLOW]
Range(minCell).Interior.Color = vbGreen
'B leg High header
Set maxRange = Range("C" & R1 & ":C" & (R1 - 5))
lMax = Application.WorksheetFunction.Max(maxRng)
Range(maxCell).Interior.Color = vbRed
Next R1
Columns("G:Z").NumberFormat = "0.00"
wrksh.Columns("A:Z").EntireColumn.AutoFit
End Select
Skip:
Next wrksh
Sheets("Parameters").Select
End Sub