VBA (Macro) auto fill down if column A is not blank.

  • Hi there... I was trying to write some code to auto fill a cells of column L,P & Q based on adjacent value of column A is not blank. VBA should populate function as soon as we enter any value in col A.


    I tried using following code for P column but as I am a beginner I don't know how to put a if function in code that is IF A<>"" then,


    Range("P2:P" & Cells(Rows.Count, 2).End(xlUp).Row) = "=IFERROR(TODAY()-R[-3]C[-14]-INT((1-WEEKDAY(TODAY())+TODAY()-R[-3]C[-14])/7)-1,""Please check rows"")"


    Also, the Col L,P and Q should be locked to prevent any accidental change in formula.


    Can anyone help me with the code please?

  • Can you paste the formula in cell P2 that you want copied down?


    Also, to confirm, if there is no data in column A you would like the same row in column P to be blank? And whenever someone enters something into a row in column A, that corresponding row in column P should be populated with the formula?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!