+ Reply to Thread
Results 1 to 4 of 4

delete duplicated columns from left to right

  1. #1
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    delete duplicated columns from left to right

    Hi,

    I have a worksheet with data columns starting from column H to infinite (currently GV). Row 4 holds an unique ID which I want to be the basis for finding duplicates and then deleting the entire column. However, have to keep in mind that I only need to delete the double existing entry to the RIGHT of the respective column.

    Example.
    Data in column H is double existing in column T and column Z, when running the macro I need the macro to delete only columns T and Z.

    I have been trying to go add a row with COUNTIF formulas to see if any entry in row 4 is double existing and then have the macro delete all columns that have a countif value above 1, but this is very sluggish and performance draining since i need to pull the formula across a hundred rows.

    I was hoping the local excel gods could point me in a pure VBA solution for this problem

    thanks,
    A2k

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: delete duplicated columns from left to right

    attach please a sample file with data and desired result
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: delete duplicated columns from left to right

    Hi, Armitage2k,

    start at the end of the columns and work through row 4 using Worksheet.Function.CountIf to decide how often the values is appearing there:

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Re: delete duplicated columns from left to right

    Dear Holger,

    this is genius stuff, works like a charm!

    Vielen herzlichen Dank,

    A2k

+ 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. Replies: 16
    Last Post: 07-25-2012, 02:03 AM
  2. How delete rows duplicated???
    By Wilmarjr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-22-2012, 05:59 PM
  3. delete duplicated first row
    By marley&me in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2009, 07:13 AM
  4. [SOLVED] Find & Delete columns to the left stopping at column B
    By Aria in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-19-2006, 08:55 PM
  5. Find & Delete columns to the left stopping at column B
    By Aria in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2006, 01:55 PM

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