Solved

Delete the entire table

Posted on 2013-12-03
1
209 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

Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

Question has a verified solution.

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

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…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

731 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