Solved

Delete the entire table

Posted on 2013-12-03
1
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 39693509
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

749 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