Insert formulas by means of a Macro
On 14 apr, 13:46, "Mucah!t" wrote:
Hello all,
I'm looking for a code which recognizes the last data entered in a
sheet and adds 3 rows of formulas beneath it.
Thanks in advance
Hi Mucah!t
In Excel 2007 I created this short code sample:
Private Sub Worksheet_Change(ByVal Target As Range)
Static blnActief As Boolean
If Not blnActief Then
blnActief = True
Target.Offset(1, 0).Formula = "=1+" & Target.Address
Target.Offset(2, 0).Formula = "=1+2*" & Target.Address
Target.Offset(3, 0).Formula = "=1+3*" & Target.Address
blnActief = False
End If
End Sub
You need the Static boolean to prevent looping.
HTH,
Wouter.
|