I want to compare values in a Multid array to a values in a single Column.
Stoploss:
45
54
76
OHLC:
37 43 30 40
32 43 41 43
32 54 76 87
I want to compare each value in Stoploss to OHLC and find the first value that is larger than Stoploss in OHLC, in this case the first number larger than 45 in OHLC will be 54. And this happens for every subsequent number in Stoploss, adjusting the OHLC array to the row number of the value in Stoploss I want to compare. There may be spaces in the range Stoploss. So far i have this:
<code>For i = 63 To 16
Set OHLC = Range("B" & i & ":" & "E" & i)
For Each cll In OHLC
If Range("x" & i).Value > 0 Then
stoploss = Range("x" & i)
End If
If cll.Value > stoploss Then
Range("s" & cll.Row) = cll.Value
End If
Next cll
Next i</code>There is no error message in my code, but no values are returned in column "S". I also know this double looping method doesn't work because it returns the first value in range B:E for each row, which is not what I want. Any help guys? Any input will be very appreciated. Thank you
Stoploss:
45
54
76
OHLC:
37 43 30 40
32 43 41 43
32 54 76 87
I want to compare each value in Stoploss to OHLC and find the first value that is larger than Stoploss in OHLC, in this case the first number larger than 45 in OHLC will be 54. And this happens for every subsequent number in Stoploss, adjusting the OHLC array to the row number of the value in Stoploss I want to compare. There may be spaces in the range Stoploss. So far i have this:
<code>For i = 63 To 16
Set OHLC = Range("B" & i & ":" & "E" & i)
For Each cll In OHLC
If Range("x" & i).Value > 0 Then
stoploss = Range("x" & i)
End If
If cll.Value > stoploss Then
Range("s" & cll.Row) = cll.Value
End If
Next cll
Next i</code>There is no error message in my code, but no values are returned in column "S". I also know this double looping method doesn't work because it returns the first value in range B:E for each row, which is not what I want. Any help guys? Any input will be very appreciated. Thank you