Try,
Sub test()
Dim rng1 As Range, rng2 As Range
With ThisWorkbook.Sheets("Plan") 'or delete thisworkbook for the activeworkbook
Set rng1 = .Range("C3:C40")
Set rng2 = .Range("E3:E40")
.Range("C2").Value = Application.Min(rng1)
.Range("D2").Value = Application.Max(rng2)
End With
End Sub
or without declaring rng1 and rng2,
Sub test()
With ThisWorkbook.Sheets("Plan") 'or delete thisworkbook for the activeworkbook
.Range("C2").Value = Application.Min(.Range("C3:C40"))
.Range("D2").Value = Application.Max(.Range("E3:E40"))
End With
End Sub
Bookmarks