Excelbuddy_7
New Member
- Joined
- Nov 6, 2015
- Messages
- 26
I have a form, where I have a Worksheet_Change event which adds a new row once data is entered in a particular cell. So my form only has one row, but will keep adding rows as required. When data is entered in cell E12, it copies the current row and pastes it below it, clearing all contents but keeping the same formatting. The code I use:
Now say, if someone wants to go back and edit the data they typed, or delete it altogether, in cell E12, this inadvertently adds another row as a change was made to the cell. I want to prevent this from happening.
Let me know if you need any more information.
Thanks for any help.
Code:
If Not Application.Intersect(Target, Range("E12:E112")) Is Nothing Then
On Error Resume Next
Target.EntireRow.Copy
Application.EnableEvents = False
Target.EntireRow.Insert
Target.EntireRow.SpecialCells(xlCellTypeConstants, 23).ClearContents
Target.EntireRow.RowHeight = 15
Application.EnableEvents = True
Application.CutCopyMode = False
End If
Now say, if someone wants to go back and edit the data they typed, or delete it altogether, in cell E12, this inadvertently adds another row as a change was made to the cell. I want to prevent this from happening.
Let me know if you need any more information.
Thanks for any help.