Home > Mobile >  Replace value in column C based on the value in column A
Replace value in column C based on the value in column A

Time:09-16

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.

CodePudding user response:

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