Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 172
- Office Version
- 2010
- Platform
- Windows
Hi everybody. I need to compare the value of Column B (in red) with the value of Column C. if column B>=Column C, how should the condition be written. Thank you
Code:
test 123.xlsm
drive.google.com
Code:
VBA Code:
Sub runx()
On Error Resume Next
Dim sArr(), dArr(), I As Long, K As Long, R As Long, Col As Long
sArr = Range("B4:C10").Value
R = UBound(sArr)
ReDim dArr(1 To R, 1 To 2)
For I = 1 To R
If sArr(I, 1) >= sArr(I, 2) Then '[B]need to fix this code[/B]
K = K + 1
For Col = 1 To 2
dArr(K, Col) = sArr(I, Col)
Next Col
End If
Next I
Range("F4:G10").ClearContents
Range("F4").Resize(K, 2) = dArr
End Sub