Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to set up a macro so that when a user alters the corresponding row
column D value, it auto-inserts the formula's into E, F and G columns to do the maths. This is so that if a user adds a row to the sheet they don't have to worry about copy pasting formulas etc. The below is what I have but nothing happens..... help! Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If Not Intersect(Range(Target.Address), Range("A:E")) _ Is Nothing And Target.Row < 1 Then Dim r As Long r = Target.Row If Cells(r, "D").Value < "" Then 'Then ' the below adds in the formula in column E, F and G Cells(r, "E").FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC[-2],'FFELibrary'!C[-3]:C[-1],2,FALSE)),"",VLOOKUP(RC[-2],'FFELibrary'!C[-3]:C[-1],2,FALSE))" Cells(r, "F").FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC[-3],'FFELibrary'!C[-4]:C[-2],3,FALSE)),"",VLOOKUP(RC[-3],'FFELibrary'!C[-4]:C[-2],3,FALSE))" Cells(r, "G").FormulaR1C1 = "=IF(ISERROR(IF(RC[-1]=0,RC[-2]*RC[-3],IF(R201C4=Sheet1!R[-7]C[-5],RC[-1]*RC[-3],RC[-2]*RC[-3]))),"",IF(RC[-1]=0,RC[-2]*RC[-3],IF(R201C4=Sheet1!R[-7]C[-5],RC[-1]*RC[-3],RC[-2]*RC[-3])))" End If End If Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A formula that autofills by trend rather than linear | Excel Discussion (Misc queries) | |||
A formula that autofills by trend, not linear | Excel Discussion (Misc queries) | |||
run macro whenever any cell is changed | Excel Programming | |||
Excell formula that autofills information | New Users to Excel | |||
Run Macro when particular cell is changed? | Excel Programming |