Solved

Delete the entire table

Posted on 2013-12-03
1
173 Views
Last Modified: 2013-12-04
Hello Experts,

I am trying to delete information in a table once it has been filtered.
All the information that appears in the table after it was filtered has to be deleted.

I have the following attempt to write the macro:

With Sheets("Initiative Summary").ListObjects("InitiativeTbl")
         .Range("Functional Area").EntireColumn.Select
         Selection.EntireRow.Delete
    End With


 "Functional Area" is the name of the column in the InitiativeTbl table. I prefer to use the name of the column and not a cell number in case there are some changes or additions made to the table.

Could you please help me figure out what's the best way to write this macro?

Thank you
0
Comment
Question by:jmac001
1 Comment
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
Comment Utility
Try:
Sheets("Initiative Summary").ListObjects("InitiativeTbl").listColumns("Functional Area").databodyrange.specialcells(xlCellTypeVisible).Delete

If you want to avoid the delete warning, surround the code with

application.displayalerts=false
'...
application.displayalerts=true

Open in new window

Thomas
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now