+ Reply to Thread
Results 1 to 5 of 5

Delete a set of Columns with 2 empty columns

  1. #1
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Delete a set of Columns with 2 empty columns

    Hi All,

    I have got a sheet that contain data of various month separated by 2 empty columns. I have got a macro that could run for a set of data, hence I need a macro to delete the older set data along with the 2 empty columns next to it and leave the next set of data alone in the same sheet.

    I have attached a sample sheet with the input and output for better understanding.

    Thanks in Advance!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Delete a set of Columns with 2 empty columns

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Re: Delete a set of Columns with 2 empty columns

    Hi,

    Thanks for your reply! The code does delete the old month data but it deletes the data in the columns A to G too.. which shouldn't happen
    Last edited by jeffreybrown; 06-03-2017 at 01:35 PM. Reason: Removed unnecessary quote!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Delete a set of Columns with 2 empty columns

    Quote Originally Posted by sarajun_88 View Post
    Hi,

    Thanks for your reply! The code does delete the old month data but it deletes the data in the columns A to G too.. which shouldn't happen
    It didn't delete A:G with your example file.

    Give this a try...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83
    Quote Originally Posted by AlphaFrog View Post
    It didn't delete A:G with your example file.

    Give this a try...

    Please Login or Register  to view this content.
    Thanks a lot!! This worked perfectly 😀

+ 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. VBA To Delete All Empty Columns
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-31-2017, 02:07 PM
  2. How to delete empty columns
    By Smasen91 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-03-2016, 03:02 AM
  3. [SOLVED] Really Delete Blank Empty Columns
    By WmBarth in forum Excel General
    Replies: 2
    Last Post: 08-26-2015, 01:37 PM
  4. Delete Empty Columns
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2014, 10:05 AM
  5. 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
  6. Delete empty cells from Columns
    By MKZS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2013, 07:57 AM
  7. how to delete empty rows or columns only
    By tallercheetah in forum Excel General
    Replies: 3
    Last Post: 02-02-2012, 10:44 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