+ Reply to Thread
Results 1 to 6 of 6

Delete Empty Columns

  1. #1
    Forum Contributor
    Join Date
    12-22-2004
    Location
    Kokomo, Indiana
    Posts
    236

    Question Delete Empty Columns

    Each month I download data from several testers we have on our production floor. I do my normal data crunching but have to endure having to delete empty columns manually. I can have over 400 columns and about 20-30% are always empty. Sometimes the empty column is by itself and other times I can have 2-4 columns side-by-side with no data in them. I want to delete all columns which have no data. Thanks.

    ajocius

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Delete Empty Columns

    Hi,

    One way would be to put an =COUNTA() function at the top of every column and then have a looping macro which worked across all these formulae and deleted the column if the formula resulted in a zero.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Delete Empty Columns

    Hi,

    Following Richards suggestion. Here is a possible code

    Please Login or Register  to view this content.
    Thanks

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Delete Empty Columns

    @fredlo2010
    I like your TurnExtrasOff/On way of doing it.

    Would this not do it if we're looping anyway?
    fredlo2010's code without the extra row.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor satputenandkumar0's Avatar
    Join Date
    11-08-2012
    Location
    Pune, India
    MS-Off Ver
    Office xp & Office 2007
    Posts
    398

    Re: Delete Empty Columns

    or try below

    Please Login or Register  to view this content.
    Regards,
    Nandkumar S.
    ---------------------------------------------------------------
    Don't forget to Click on * if you like my solution.

  6. #6
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Delete Empty Columns

    Quote Originally Posted by jolivanes View Post
    @fredlo2010
    I like your TurnExtrasOff/On way of doing it.

    Would this not do it if we're looping anyway?
    fredlo2010's code without the extra row.
    Please Login or Register  to view this content.
    Thanks jolivanes,

    I was just following Richard's suggestion literally. After reading your post I was thinking that we don't even need to loop.

    Please Login or Register  to view this content.
    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Delete Empty Rows and empty columns from the word table
    By mvneema in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2014, 10:51 AM
  2. Delete empty cells from Columns
    By MKZS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2013, 07:57 AM
  3. Delete row if multiple columns empty
    By amadman114 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2013, 06:53 AM
  4. [SOLVED] Delete rows when two columns are empty
    By Musoguy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-29-2013, 09:00 AM
  5. Macro to Delete empty columns
    By Darth Cor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1