Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Inserting/Deleting Rows when values are added /cleared

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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting and Deleting Rows in Excel ttonkel Excel Worksheet Functions 2 March 7th 09 03:06 PM
CF goes crazy when deleting/inserting rows DoubleZ Excel Discussion (Misc queries) 1 October 2nd 08 09:33 PM
Speed of Excel When Inserting & Deleting Rows Gerry Excel Discussion (Misc queries) 13 March 5th 08 04:04 AM
Inserting/deleting rows between worksheets Klee Excel Worksheet Functions 4 July 22nd 07 07:41 PM
inserting deleting rows?how do i get the other sheets to do the sa cunningham82 Excel Discussion (Misc queries) 0 December 27th 06 09:51 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"