
Originally Posted by
valauca
IF the value in Column6 > 0 AND Value in Column5 = 0 AND Value in Column8 = 0 THEN Replace the 0 with the value "1000".
IF (F8>0 AND E8=0 AND H8=0) THEN (E8 AND H8 = 1000)
Sub test()
Dim myItem, cols, s As String, e, myVal
myItem = Array(Array(6, ">0"), Array(5, "=0"), Array(8, "=0"))
cols = "5,8"
myVal = "1000"
With Cells(1).CurrentRegion
For Each e In myItem
s = s & "*(" & .Columns(e(0)).Address & e(1) & ")"
Next
.Value = Evaluate("if(" & Mid$(s, 2) & "*(isnumber(match(column(" & Cells(1).Resize(, _
.Columns.Count).Address & "),{" & cols & "},0)))," & myVal & "," & .Address & ")")
End With
End Sub
myVal is the new value to replace,
other numers are relative column index within the data range.
Bookmarks