Delete Row from Table

ManUBlueJay

Active Member
Joined
Aug 30, 2012
Messages
302
Office Version
  1. 2016
Platform
  1. Windows
I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell.
In the past I have used this simple code "Range("MyRange").EntireRow.Delete"

This does not work today in Excel 2016
 
Just tried it with that type of formula & everything works for me.
Does this work
VBA Code:
With Range("myrange").ListObject
   Intersect(Range("myrange").EntireRow, .DataBodyRange).Delete
End With
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Bingo!! Perfect. Thank you for your perseverance
I am tempted to rebuild this file starting with Excel 2016. It is probably somehow corrupted.
 
Upvote 0
It may just be that something has changed between 2016 & 365, that enables deleting of entire rows within tables.
 
Upvote 0
Like I mentioned in my first post. I have used this exact same line in other tables.
This has been my standard way using a named range to identify the cell and then deleting the entire row.
That's why it is frustrating that it all of a sudden doesn't work, but I don't know enough to figure it out.
 
Upvote 0
It's possible that something on that sheet has been corrupted & wouldn't hurt to rebuild it.
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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