Delete List Row

Papi

Well-known Member
Joined
May 22, 2007
Messages
1,592
When I use a list in 2003 I use the shortcut Alt > E > W to delete one row. When I record the same keystrokes it converts that to
Selection.ListObject.ListRows(14).Delete
. That unfortunately is row specific. Any idea how to delete a row using a list (or selected rows) using VBA?
Thanks
 
Last edited:
I just read that when table filtering is enabled, some Excel commands will produce different results, e.g. When deleting data from the Table, entire rows must be deleted. I made some tests and when the Table is filtered, you can only delete entire sheet rows and not just table rows, as when the table is unfiltered.
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
When the cursor enters the table it automatically turns the filter dropdowns on (at least in 2003 at work). By going Alt > E > W, it deletes the entire data on the section of the table and data on the outside is not affected. If the normal delete is used, it will delete the entire row. What you wrote does exactly what Alt > E > W does which deletes the row from the section it sits in. The only item that it will not affect is the last data row (my mistake on wording earlier). When the cursor is placed at the bottom of a list/table it opens a new row to keep the table in the same format as before i.e. formulas will carry down to the new row. So the new row is what I was calling the last row. That is what I meant by one down from the last one. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,391
Members
449,445
Latest member
JJFabEngineering

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top