Delete Row from Table

ManUBlueJay

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

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,217
Office Version
  1. 365
Platform
  1. Windows
Is that cell within your table?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,217
Office Version
  1. 365
Platform
  1. Windows
Is the sheet protected?
 

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
224

ADVERTISEMENT

No, but I am calling it while I am on a different sheet. However I tried selecting the sheet with the table (Would prefer not to) and then running the macro. I get the same error
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,217
Office Version
  1. 365
Platform
  1. Windows
The fact that you have a different sheet active, should not make any difference.
The only way I can get the same error as you, is if the sheet is protected, so not sure why you are having trouble.
 

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
224

ADVERTISEMENT

It is for sure ot protected. To be safe I added a line Worksheets("database").Unprotect, still get the same Run time 1004
 

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
224
What are you using in tour named range. I am using Offset and Match to find the cell I am looking to delete. Everything looks good till I run the Macro
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,217
Office Version
  1. 365
Platform
  1. Windows
What is the formula?
 

ManUBlueJay

Board Regular
Joined
Aug 30, 2012
Messages
224
=OFFSET(Database!$X$1,MATCH(DeleteName,All_UpdateTable_Names,0),0)
DeleteName a also named Range
All_UpdateTable_Names is another named range that is the whole column in the table where the names are stored.

It finds the exact cell I am looking for.

One clue is this was a file that was first created in 2002 and has been through a bunch of Excel updates and maybe I am looking at something Corrupted deep down.
It is currently Excel 2016
 

Watch MrExcel Video

Forum statistics

Threads
1,108,855
Messages
5,525,229
Members
409,637
Latest member
LT TASL

This Week's Hot Topics

Top