vba to delete rows in table error

dshafique

Board Regular
Joined
Jun 19, 2017
Messages
171
Hi guys, for one of my spreadsheets i wanted the vba to check if a cell was blank in the first column of my table, and if so to delete it.

this is the code which i usually use
Code:
Range("IRA[CIO]")..SpecialCells(xlBlanks).EntireRow.Delete

but when i run it, i get an error saying delete method of range class failed.

any idea what it is and how i can overcome this?

thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I see two ..
I think it should only be one.
Range("IRA[CIO]")..SpecialCells(xlBlanks).EntireRow.Delete
 
Upvote 0
Have you confirmed column IRA[CIO] is completely empty in your table? That error suggests it may not be, hence it can't find any special cells to then delete entire row...
 
Upvote 0
IRA is the name of a table in one of my sheets. there are gaps in the CIO column, which I wanted it to delete. I found a workaround for it,
i just did
Code:
Columns("A").[COLOR=#333333]SpecialCells(xlBlanks).EntireRow.Delete[/COLOR]
it did what I needed it to. thanks :)
 
Upvote 0
Does seem unusual your workaround works but the original didn't, the only part you've changed is the range object ...

.. but happy days, glad it's resolved and you found your own answer!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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