Hi, Im trying to offset the range in ValuesRange = Range("A1:A4"), but I need to just offset cell A4, atm it offsets the entire range so it looks like : A2:A5 A3:A6 etc., I just need the A4 part offset, so it looks like A1:A5, A1:A6, A1:A7 etc.,
Is there anyway to do this, without splitting the range into two variables?
Thanks.
Sub ValleyDips()
Dim ValuesRange As Range
Dim ResultCell As Range
Dim CriteriaValue As Range
Set ValuesRange = Range("A1:A4")
Set ResultCell = Range("C3")
Set CriteriaValue = Range("A1")
HighestCurentValue = CriteriaValue
For j = 1 To 4
ResultCell = Application.WorksheetFunction.CountIf(ValuesRange, "<" & CriteriaValue)
If ResultCell > 2 Then
d = ValuesRange.Offset(i, 0).Address
i = i + 1
MsgBox d & HighestCurentValue
End If
If ResultCell < 2 Then
d = CriteriaValue.Offset(i, 0).Address
i = i + 1
MsgBox d & HighestCurentValue
End If
'MsgBox d & HighestCurentValue
Next j
End Sub
Bookmarks