Hi,
I am new to VBA and thinking if there is a more elegant way to achieve what I am trying to do in the code.
I am trying to find the value of "Q" ("C18") at which any value in column "D" is greater than the corresponding value in column "B" ?
Basically can I use "For i = 1 to 5" instead of having to write down each cell address to get the required value of "Q" ? My code is as follows. Any help would be appreciated. Thanx
Sub FindQ()
Dim Q As Range
Range("C18") = 1
Set Q = Range("C18")
Do Until (Range("D21") > Range("B21") Or Range("D22") > Range("B22") Or Range("D23") > Range("B23") Or Range("D24") > Range("B24") Or Range("D25") > Range("B25"))
Q = Q + 1
Loop
Q = Q - 1
End Sub
Bookmarks