+ Reply to Thread
Results 1 to 6 of 6

Select and delete every other columns

  1. #1
    Registered User
    Join Date
    02-21-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2013
    Posts
    15

    Select and delete every other columns

    I need to select and delete a few columns from a range but at intervals. For example: If my range starts from Column F, then I'd like to select 7 columns, leaving Column L, and then redoing this same pattern in a loop for the rest of the columns, and then deleting those selected columns. The columns that I want to retain have calculated fields in them. So I want to delete the rest of the columns that I've no need for. But doing this manually for a large number of columns will be difficult as I'd have to do this again the next time any other data is uploaded.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Select and delete every other columns

    By deleting columns you changes column position/name so I think you need to upload a workbook showing what you wish to delete.

    Alf

  3. #3
    Registered User
    Join Date
    02-21-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Select and delete every other columns

    I need to delete the greyed out columns.

    Plus it'd be good if Column F and G can be included as well for deletion. But if you leave out these 2 columns then I need to delete every 7 columns after 1 interval each.Sample.xlsm

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Select and delete every other columns

    Perhaps a macro like this than?

    Please Login or Register  to view this content.
    The problem was with the "#VALUE!" in row 1. In the end I had to replaced it with the value "Fixed" in order to get the macro to work. Macro looks for value "Fixed" or if value of cells in row 1 is "xxx" i.e. 3 diggits long. If so column is not deleted.

    Alf
    Last edited by Alf; 02-23-2014 at 12:40 PM. Reason: additional info

  5. #5
    Registered User
    Join Date
    02-21-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Select and delete every other columns

    Works like a charm.. Thank you so much!

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Select and delete every other columns

    Glad to be of help and thanks for feedback and rep.

    Looking at the code you could also use this, same result but will not change value to "Fixed" in row 1 and code is a bit shorter.

    Please Login or Register  to view this content.
    Alf

+ 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 to Select and Delete Columns and or Rows
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-09-2013, 09:40 AM
  2. Register - select the first date in the next month then delete the columns
    By dazza67 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2013, 04:07 AM
  3. Locking columns containing formulas but being able to select & delete rows
    By bernborough in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2010, 03:34 AM
  4. Replies: 1
    Last Post: 04-23-2007, 04:23 PM
  5. Search & delete ANY text in select columns
    By huruta in forum Excel General
    Replies: 2
    Last Post: 06-30-2006, 02:35 PM

Tags for this Thread

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