Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to delete the first row of the tab?

Status
Not open for further replies.

feipezi

IS-IT--Management
Aug 10, 2006
316
US
Hi,

I have an Excel table and I tried to delete the first row of the tab but it won't let me. Is that protected? I cannot say for sure.

I had code like the following but not working at all.


Sub Del()
ActiveSheet.Rows(1).Delete
End Sub


Please see the attached.

Thanks in advance.
 
 http://files.engineering.com/getfile.aspx?folder=b097634a-d6ac-44ae-ab3e-b959e5eff153&file=Part_of_Federal_Chargeback_Report_August_2015.xlsm_04-Sep-15_12-30-56.xlsx
Any message? I have no problems with your code. Test active sheet's name (MsgBox AciiveSheet.Name) first.

combo
 
Hi,

You cannot delete the HEADINGS from a Structured Table.

ActiveSheet.Rows(1) refers to the HEADING row.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Thanks guys!

What do you mean "any message"? Did you open the attachment and try to delete the first row? Of course, there is no message at all.

No Skip. It's not the heading row. You open a new tab and run "ActiveSheet.Rows(1).Select". The first row will be selected, not the headers. No one can delete the header.

In case you did not see the attachment, here is what's going to happen: right-click the first row and then you can see a drop-down; on the drop-down, "Delete" is there but not highlighted; it means there is no response as you click it.

The idea is to copy a range from Col. B to Col. W from Access MDB to replace the data I sent you. Since I'm unable to replace the first row, I'll have to paste the data from the 2nd row down, and copy the 2nd row (it's the header) to the first row; then delete the 2nd row. It's clumsy but I don't have other choices, do I?

I cannot delete the first row but I can place something in it. It's weird, isn't it?

Thanks again.
 
In case you did not see the attachment, here is what's going to happen: right-click the first row and then you can see a drop-down; on the drop-down, "Delete" is there but not highlighted; it means there is no response as you click it.

Your workbook has ONE TAB.

On this tab is a Structured Table with headings in ROW 1.

If you select the first row (Headings) and right-click, the pop up shows Delete as an option that cannot be selected, because THIS ROW IS A HEADING ROW IN A STRUCTURED TABLE! You cannot delete the heading row in a Structured Table. It is a feature that prevents a stupid mistake.

I do not understand the rationale of your last paragraph.

Of course you could CONVERT the Structured Table to a range, and then you could Delete Row 1. But there is good reason that Delete is disabled in a true table setting.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
So I'm getting the picture, I think.

The data in column B and following is from an Access table. So why are you COPYING data from a table??? Kind of klunky and Micky mouse!

What it seems you ought to do is query the Access table directly from Excel into a sheet @ A1. THEN put your lookup in the LAST column, that will adjust as new data is queried via a simple REFRESH.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top