Inserting/Deleting Rows when values are added /cleared

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top