Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() A simple macro to delete 1 row at a time when the value of a cell changes now deletes 250+ rows at a time. I only want to delete the 1st row of a worksheet when there is a change in a cell on the 1st row, then move the following row in its place. Private Sub Worksheet_Change(ByVal Target As Range) Range("1:1").Select Selection.Delete xlShiftUp End Sub Thanks for any help!! -- stumanchu ------------------------------------------------------------------------ stumanchu's Profile: http://www.excelforum.com/member.php...o&userid=33793 View this thread: http://www.excelforum.com/showthread...hreadid=535662 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you change a cell, the Change event is called. This deletes
row 1, which is a change, so Change is called again, which deletes row 1, which causes Change to be called again, over and over and over. Change your code to Application.EnableEvents = False Range("1:1").Select Selection.Delete xlShiftUp Application.EnableEvents = True -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "stumanchu" wrote in message ... A simple macro to delete 1 row at a time when the value of a cell changes now deletes 250+ rows at a time. I only want to delete the 1st row of a worksheet when there is a change in a cell on the 1st row, then move the following row in its place. Private Sub Worksheet_Change(ByVal Target As Range) Range("1:1").Select Selection.Delete xlShiftUp End Sub Thanks for any help!! -- stumanchu ------------------------------------------------------------------------ stumanchu's Profile: http://www.excelforum.com/member.php...o&userid=33793 View this thread: http://www.excelforum.com/showthread...hreadid=535662 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I see!! Thanks a bunch - it works! -- stumanchu ------------------------------------------------------------------------ stumanchu's Profile: http://www.excelforum.com/member.php...o&userid=33793 View this thread: http://www.excelforum.com/showthread...hreadid=535662 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting Rows - only deletes content | Excel Discussion (Misc queries) | |||
Macro that deletes rows from cell containing End to end of data. | Excel Discussion (Misc queries) | |||
shared file adds or deletes rows | Excel Discussion (Misc queries) | |||
Help With a Loop That Deletes Rows | Excel Programming | |||
Macro that deletes certain rows and not others | Excel Programming |