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
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Code:
Rows(MyRange.Row).EntireRow.Delete
 
Upvote 0
In what way doesn't the code in your op work?
 
Upvote 0
I just ran a simple macro with only this line

VBA Code:
Sub Test()
Rows(MyRange.Row).EntireRow.Delete
End Sub
 
Upvote 0
I was referring to the code you posted.
 
Upvote 0
I get a Run Time Error 1004 "Delete method of Range class failed"
 
Upvote 0
Is MyRange a named range or is it a variable that you have declared in the macro?
 
Upvote 0
It is a named range. My formula finds the right cell to delete. The table is 8 Cols wide.
The Table is called "MyTable"
 
Upvote 0
What does this return
VBA Code:
MsgBox Range("myrange").Address
 
Upvote 0

Forum statistics

Threads
1,212,933
Messages
6,110,751
Members
448,295
Latest member
Uzair Tahir Khan

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