Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 172
- Office Version
- 2010
- Platform
- Windows
Hello everyone. I need to filter in the range B2:D100 only when column B has the value =1 , and when outputting the first row results for the rows below (As the image describes). Thank you
drive.google.com
VBA Code:
Sub FILLTEST()
On Error Resume Next
Dim sArr(), dArr(), I As Long, K As Long, R As Long, Col As Long
sArr = Range("B2:D1000").Value
R = UBound(sArr)
ReDim dArr(1 To R, 1 To 3)
For I = 1 To R
If sArr(I, 1) = 1 Then
K = K + 1
For Col = 1 To 3
dArr(K, Col) = sArr(I, Col)
Next Col
End If
Next I
Range("G2:I31").ClearContents
Range("G2").Resize(K, 3) = dArr
End Sub
Book1.xlsm
