+ Reply to Thread
Results 1 to 2 of 2

Using a Macro to Delete Empty Columns

  1. #1
    Registered User
    Join Date
    01-25-2016
    Location
    Pennsylvania
    MS-Off Ver
    2013
    Posts
    5

    Exclamation Using a Macro to Delete Empty Columns

    I can't figure out why my code won't work. Columns 7-10 are supposed to delete when I run the code.

    Columns.PNG

    Code:

    Dim lngCount As Long

    For i = 3 To 12
    lngCount = Application.WorksheetFunction.CountA(Columns(i))
    If lngCount <= 1 Then Columns(i).EntireColumn.Delete
    Next i
    Last edited by PleaseHelpMe3; 01-25-2016 at 06:04 PM.

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Using a Macro to Delete Empty Columns

    Please Login or Register  to view this content.

    Kind regards
    Leo

+ 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. Macro Button to Delete Entire Row if cells in two columns are empty in certain worksheet
    By Adriana Lee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2015, 07:49 PM
  2. VBA macro to delete all empty rows and columns
    By specialist1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2015, 04:01 PM
  3. Delete Empty Columns
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2014, 10:05 AM
  4. 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
  5. Delete row if multiple columns empty
    By amadman114 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2013, 06:53 AM
  6. how to delete empty rows or columns only
    By tallercheetah in forum Excel General
    Replies: 3
    Last Post: 02-02-2012, 10:44 AM
  7. [SOLVED] 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