Solved

Delete the entire table

Posted on 2013-12-03
1
201 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
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 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