Link to home
Start Free TrialLog in
Avatar of gvilbis
gvilbis

asked on

how do i displaying all rows which column "Q" minus column "II" > 0 in Macro Excel 2007 VB?

i have the following code and i would like to add condition to display the rows that column "Q" minus Column "II" > 0:

Set wbResult = Workbooks.Open(Filename:=ThisWorkbook.Path & "\Master Book.xlsm", Password:="White1022", ReadOnly:=True)
    RowInd = 2
    For i = 2 To Workbooks(wbResult.Name).Worksheets("Sheet1").Range("A2").CurrentRegion.Rows.Count
        If Workbooks(wbResult.Name).Worksheets("Sheet1").Range("AN" & i) <> "" Then
            Workbooks(wbResult.Name).Worksheets("Sheet1").Range(Cells(i, 1), Cells(i, 106)).Copy ThisWorkbook.Worksheets("Sheet1").Range("A" & RowInd)
                ThisWorkbook.Worksheets("Sheet1").Range("A" & RowInd) = i
            RowInd = RowInd + 1
        End If
    Next i
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial