+ Reply to Thread
Results 1 to 7 of 7

Auto delete columns

  1. #1
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Auto delete columns

    Hi

    I currently use a spreadsheet to record weekly vehicle mileage. I'm looking for a way to automatically delete a column based on a cell value within the column when the vehicle goes off strength
    Last edited by JamesT1; 05-04-2009 at 02:17 PM. Reason: more information

  2. #2
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Auto delete columns

    Hi James,

    Can you attach a sample workbook to make us understand your problem better?

    --Karan--

  3. #3
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Re: Auto delete columns

    Hi Karen

    The spreadsheet is too large to attach,,,,, the attachment has a small example.....

    If the vehicle in cell "G2" is taken off strength and this cell is blank then I am looking for column G to be automatically deleted

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Auto delete columns

    What does "taken off strength" mean to us? And what do you mean by "automatically"? That's a very iffy concept.

    Click a button and the columns "automatically" delete if appropriate
    Change a value in a cell and the column "automatically deletes (crazy thought, IMO.)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Auto delete columns

    Going by the key phrase "if G2 is blank" I wrote a macro that will delete any column that has blank cell in row2 starting at cell C2.

    Your sample sheet had formulas, so when I deleted G2 to make it empty and ran the macro, it did what you wanted, but the formulas in the proceeding columns are broken by that process. FYI.
    Please Login or Register  to view this content.
    The on-demand macro is my suggestion, if it were "automatic"...what if you made a mistake? Oops.

  6. #6
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Re: Auto delete columns

    Hi JBeaucaire

    "Taken Off Strength" means the vehicle has been sold or disposed off,,,,, when this happens I'm looking to delete the column where the weekly miles are kept,........

  7. #7
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Re: Auto delete columns

    Hi JBeaucarie

    My Apologies,,,,, in a hurray to put the example together and copied the formulas left to right,,, they should be vertical,,,,

    many thanks for the code I will try it on my sheet and let you know how I get on

+ 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