Replace value in column C based on the value in column A

Viewed 32

I need a simple VBA code (formula won't do) that replaces the value in column C to 0(zero) if the corresponding cell in column A is not empty.

1 Answers

That should do

Dim x as long
    for x = 1 to Cells(Rows.count, "A").End(xlUp).Row
    if Cells(x,"A").Value <> vbNullString then
    Cells(x,"C").Value = "0" 'when you want it to be the number, otherwise just don't use the "
    End If
    Next x
Related