Delete Row from Table

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
226
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,474
Office Version
  1. 365
Platform
  1. Windows
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
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
226
Bingo!! Perfect. Thank you for your perseverance
I am tempted to rebuild this file starting with Excel 2016. It is probably somehow corrupted.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,474
Office Version
  1. 365
Platform
  1. Windows
It may just be that something has changed between 2016 & 365, that enables deleting of entire rows within tables.
 

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
226
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,474
Office Version
  1. 365
Platform
  1. Windows
It's possible that something on that sheet has been corrupted & wouldn't hurt to rebuild it.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,258
Messages
5,527,662
Members
409,781
Latest member
Maxcwy2020

This Week's Hot Topics

Top