Inserting/Deleting Rows when values are added /cleared
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error Goto ws_exit:
With Target
If .Column = 1 Then
If .Cells.Count = 1 Then
.Offset(1).EntireRow.Insert xlShiftDown
End If
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub
--
HTH
Bob Phillips
"teresa" wrote in message
...
Hi, I have the following code, I need to tweak it so that only if i insert
a
value
into "A" column a line is inserted below, currently if i insert values
into
any other
col a line is inserted, also if i delete/clear the value that Ive just
added
the line that
has been inserted will be deleted
Help is much appreciated
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 Then
Target.Offset(1).EntireRow.Insert xlShiftDown
End If
End Sub
|