![]() |
Inserting a row when a value is entered
I need code for the following:
If I enter a value in a2 , a row is inserted below Thanks for any assistance |
Inserting a row when a value is entered
Use this sheet event code:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count = 1 Then Target.Offset(1).EntireRow.Insert xlShiftDown End If End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "teresa" wrote in message ... I need code for the following: If I enter a value in a2 , a row is inserted below Thanks for any assistance |
Inserting a row when a value is entered
You haven't tested A2 Rob.
Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Address = "$A$2" Then .Offset(1).EntireRow.Insert xlShiftDown End If End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Rob van Gelder" wrote in message ... Use this sheet event code: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count = 1 Then Target.Offset(1).EntireRow.Insert xlShiftDown End If End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "teresa" wrote in message ... I need code for the following: If I enter a value in a2 , a row is inserted below Thanks for any assistance |
Inserting a row when a value is entered
Thanks Bob - very helpful
"Bob Phillips" wrote: You haven't tested A2 Rob. Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Address = "$A$2" Then .Offset(1).EntireRow.Insert xlShiftDown End If End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Rob van Gelder" wrote in message ... Use this sheet event code: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count = 1 Then Target.Offset(1).EntireRow.Insert xlShiftDown End If End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "teresa" wrote in message ... I need code for the following: If I enter a value in a2 , a row is inserted below Thanks for any assistance |
Inserting a row when a value is entered
I assumed A2 was for example - you're right... Thanks.
-- Rob van Gelder - http://www.vangelder.co.nz/excel "Bob Phillips" wrote in message ... You haven't tested A2 Rob. Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Address = "$A$2" Then .Offset(1).EntireRow.Insert xlShiftDown End If End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Rob van Gelder" wrote in message ... Use this sheet event code: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count = 1 Then Target.Offset(1).EntireRow.Insert xlShiftDown End If End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "teresa" wrote in message ... I need code for the following: If I enter a value in a2 , a row is inserted below Thanks for any assistance |
All times are GMT +1. The time now is 01:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com