+ Reply to Thread
Results 1 to 3 of 3

Delete columns where the last row in the column = 0

  1. #1
    Registered User
    Join Date
    06-01-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    16

    Delete columns where the last row in the column = 0

    Hi All,

    I have a worksheet with a range that has a set amount of columns (A:AJ) but a variable amount of rows (anywhere from 3:20).

    The last row holds the sum of the column. Column A holds a bunch of names.

    What I would like to have is a macro that looks at the last row for each column from B to AJ and deletes the entire column if the last row in the column = 0.

    My problem is that as soon as you delete one column, the range changes, meaning it skips columns. I need it to look at each column and delete the columns with 0 in the last row without skipping any columns.

    I think this means I need a "loop" marco but I have no idea how to do it.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Delete columns where the last row in the column = 0

    You could use this code:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,937

    Re: Delete columns where the last row in the column = 0

    Modify your macro to start at the last column working from right to left.
    Please Login or Register  to view this content.
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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