Here's my macro... I just want to delete the cells in rE calculated columns which occur before the iMin.... and i didn't know how.
Any help would be great.
Thanks
Sub Brosef()
Dim iMax As Double, iMin As Double, lRowMax As Long, lCol As Long
Dim rE As Range, rR As Range
For lCol = 2 To 5
Set rR = Range(Cells(2, lCol), Cells(20000, lCol))
iMax = Application.WorksheetFunction.Max(rR)
lRowMax = rR.Find(iMax).Row
iMin = Application.WorksheetFunction.Min(rR.Resize(lRowMax - rR.Row))
MsgBox ("Max: " & iMax & "iMin: " & iMin & "Row: " & lRowMax)
For Each rE In rR
rE.Offset(, 4) = rE - iMin
Delete.Cells.rE < iMin
Next rE
Next lCol
End Sub
Any help would be great.
Thanks
Sub Brosef()
Dim iMax As Double, iMin As Double, lRowMax As Long, lCol As Long
Dim rE As Range, rR As Range
For lCol = 2 To 5
Set rR = Range(Cells(2, lCol), Cells(20000, lCol))
iMax = Application.WorksheetFunction.Max(rR)
lRowMax = rR.Find(iMax).Row
iMin = Application.WorksheetFunction.Min(rR.Resize(lRowMax - rR.Row))
MsgBox ("Max: " & iMax & "iMin: " & iMin & "Row: " & lRowMax)
For Each rE In rR
rE.Offset(, 4) = rE - iMin
Delete.Cells.rE < iMin
Next rE
Next lCol
End Sub