Hey, I have been working on this macro to analyze data. And I keep getting an error when i try to find lRowMin. It's driving me nuts, so any help would be greatly appreciated.
Thanks a lot.
Sub carney()
Dim iMax As Double, iMin As Double, lRowMax As Long, lRowMin As Long, lCol As Long
Dim rAY As Range, rR As Range, rE As Range
Application.ScreenUpdating = False
For lCol = 3 To 7 '49 from column C to AW
Set rR = Range(Cells(2, lCol), Cells(35000, lCol))
iMax = Application.WorksheetFunction.Max(rR)
lRowMax = rR.Find(iMax, rR.Cells(rR.Rows.Count)).Row
Set rE = Range(Cells(2, lCol), Cells(lRowMax, lCol))
iMin = Application.WorksheetFunction.Min(rE)
lRowMin = rE.Find(iMin, rE.Cells(rE.Rows.Count)).Row
For Each rAY In Range(Cells(lRowMin + 1, lCol), Cells(35000, lCol))
rAY.Offset(, 44) = rAY - iMin
Next rAY
Next lCol
Application.ScreenUpdating = True
End Sub
Thanks again in advance.
Erin
Thanks a lot.
Sub carney()
Dim iMax As Double, iMin As Double, lRowMax As Long, lRowMin As Long, lCol As Long
Dim rAY As Range, rR As Range, rE As Range
Application.ScreenUpdating = False
For lCol = 3 To 7 '49 from column C to AW
Set rR = Range(Cells(2, lCol), Cells(35000, lCol))
iMax = Application.WorksheetFunction.Max(rR)
lRowMax = rR.Find(iMax, rR.Cells(rR.Rows.Count)).Row
Set rE = Range(Cells(2, lCol), Cells(lRowMax, lCol))
iMin = Application.WorksheetFunction.Min(rE)
lRowMin = rE.Find(iMin, rE.Cells(rE.Rows.Count)).Row
For Each rAY In Range(Cells(lRowMin + 1, lCol), Cells(35000, lCol))
rAY.Offset(, 44) = rAY - iMin
Next rAY
Next lCol
Application.ScreenUpdating = True
End Sub
Thanks again in advance.
Erin