Home |
Search |
Today's Posts |
#8
![]() |
|||
|
|||
![]()
Hi
Thank you all for your help; I really appreciate it. I just started to try the different macros to see which one works better for me. But I need to get them working first (remember that I do not know VBA). I have so problems and I wonder if you could help me again. Auric’s macro: For some reason sometimes it does not work as it should and it deletes the rows that have “keepThisRow” in column A; the rows are the ones at the end of the table. Can you please tell me what I did wrong? I attach a drawing so you can see the rows that should not be deleted. Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Sub deleteRow_Click() ' Dim rng As Range ActiveSheet.Unprotect Password:="123" ' On Error GoTo ErrHandler ' If Cells(ActiveCell.Row, 1).Value < "keepThisRow" Then _ ActiveCell.EntireRow.Delete xlUp ' ErrHandler: ' ActiveSheet.Protect Password:="123", DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowSorting:=True ' End Sub Could someone please tell me what I have to do in for example Auric’s macro so de delete button does not delete the last row in the table? If I write in column A "keepThisRow" it does not delete it, but when I add new rows using the "Add Row" button it copies “keepThisRow” to column A in the new rows, and then I cannot delete them. Last edited by gemiho : May 21st 13 at 12:40 AM |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to delete commas and spaces when not needed ... S&R way, or macro way? | Excel Programming | |||
Macro needed to identify value and delete row if value below targe | New Users to Excel | |||
Help needed with find & Delete | Excel Programming | |||
Macro needed to delete rows | Excel Programming | |||
delete code needed | Excel Programming |