Reputation: 1
how to get the only name which is colum B in cloum E when the status is > 0 in Excel VBA, please help out.
Upvotes: 0
Views: 5685
Reputation: 29478
Simple Example and should be expanded to fit you needs
Sub CopyName()
Dim lcell AS Range
For Each lcell in Range("$B$2","$B$15")
If Cells(lcell.Row,lcell.Column + 1) > 0 Then
Cells(lcell.Row,"E").Value = lcell.Value
End If
Next lcell
End Sub
Upvotes: 1
Reputation: 3332
In Column E, you can paste the following:
=IF(B1>0, A1, "")
If column B has a value greater than 0, it will fill in column A's value. Otherwise, it'll fill in an empty string (i.e. nothing).
Upvotes: 0