![]() |
Macro to autofill formula in every row
Hello,
I'm attempting to write a macro that will insert a formula starting in cell "C13", in every row (straight down the C column), to the end of the range of the spreadsheet. The formula I want to enter is "=IF(AND(D13="",E13=""),"",IF(D13="","50","40" ))" Is there anyone that could kindly help me with this? Thanks. |
Macro to autofill formula in every row
Thank you very much.
Works exactly as needed! Tom Ogilvy wrote: set rng1 = Activesheet.UsedRange Set rng = Range("C13",Cells(rng1(rng1.count).row,"C")) rng.Formula = "=IF(AND(D13="""",E13=""""),"""",IF(D13="""",50,40 ))" If you really want the 50 and 40 to be strings rng.Formula = "=IF(AND(D13="""",E13=""""),"""",IF(D13="""",""50" ",""40""))" if we could count on column A (as an example) to have a value in the last row you want to use you could do Set rng = Range("C13",Cells(Cells(rows.count,1).End(xlup).ro w,"C")) -- Regards, Tom Ogilvy "Slim" wrote: Hello, I'm attempting to write a macro that will insert a formula starting in cell "C13", in every row (straight down the C column), to the end of the range of the spreadsheet. The formula I want to enter is "=IF(AND(D13="",E13=""),"",IF(D13="","50","40" ))" Is there anyone that could kindly help me with this? Thanks. |
All times are GMT +1. The time now is 06:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com