![]() |
Search for formulas in cells and apply to new record--no data form.
Hi there,
Code such as the one below copies formulas in the last cells of columns 3 and 10 down to the new rows when inserted. However, I need to allow the user to overwrite the formula in column 3 with any text value. If the user overwrites this formula on the last row, and then manually goes to a new row, then the code below doesn't work (it simply copies what value is in the above cell). Is there a way for code search upward in columns 3 and 10 until it reaches the last cells with formulas, and apply the formulas to the new cells in columns 3 and 10 on the new row? Or, is there a way to store the formulas: =IF(A21<"",B21,"") in column 3 =IF(B21<0,IF(C21<B21,A21&", "&LEFT(C21,2),A21&", "&LEFT(B21,1)),"") in column 10 behind the worksheet? 'This code carries formulas down from the previous row but does not 'take into consideration if the formula has been overwritten in the row above. If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub On Error GoTo CleanUp: With Target If .Value < "" Then Application.EnableEvents = False .Offset(0, 3).FormulaR1C1 = "=RC[-1]=R2C3" .Offset(0, 10).FormulaR1C1 = "=RC[-1]=R2C10" End If End With CleanUp: Application.EnableEvents = True Thanks a lot! Eric |
All times are GMT +1. The time now is 11:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com