Hi Everyone,
I am trying to execute what I thought was a few simple lines of code but it is not working as expected. The test that I am trying to execute is if there are values greater than .07 then print them on another worksheet, however it is printing everything including values that are 0. Can anyone help?
I am trying to execute what I thought was a few simple lines of code but it is not working as expected. The test that I am trying to execute is if there are values greater than .07 then print them on another worksheet, however it is printing everything including values that are 0. Can anyone help?
Code:
Dim lastRow As Long
Dim mlRow As Long
lastRow = Cells.Find("*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim wrdArray() As String
Dim cleanKWarray() As String
wrdArray = Split(Range("A1"), " - ")
cleanKWarray = Split(wrdArray(3), " (")
Dim y As Long
Range("H3:H" & lastRow).Formula = "=If(OR(b3=""You"", b3=""test.com""), 0,Iferror(E3 * f3, 0))"
Dim testValue As Integer
testValue = 0.07
For y = 3 To lastRow
mlRow = results.Cells.Find("*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If Cells(y, 8).Value = 0 And Cells(y, 8).Value < testValue Then
'do nothing
'Debug.Print Cells(y, 8).Value
Else
results.Range("A" & mlRow + 1) = wrdArray(2)
results.Range("B" & mlRow + 1) = cleanKWarray(0)
results.Range("C" & mlRow + 1) = Cells(y, 1).Value
results.Range("E" & mlRow + 1) = Cells(y, 2).Value
results.Range("F" & mlRow + 1) = Cells(y, 5).Value
results.Range("G" & mlRow + 1) = Cells(y, 6).Value
results.Range("H" & mlRow + 1) = Cells(y, 8).Value
End If
Next