+ Reply to Thread
Results 1 to 8 of 8

remove duplicates and delete empty cells

  1. #1
    Registered User
    Join Date
    07-06-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    98

    remove duplicates and delete empty cells

    Hi there,

    I have a set of data in one column of "Sheet 1". I want to remove the duplicates and delete all empty cells. However this set of data with removed duplicates and deleted cells shall then be posted in "Sheet 2". The first set of data must be in cell B6. The title must not be shown. In addition the cells in Sheet 2 must not have any formatting.

    The button to activate the duplicate remover and empty cell deleter shall be on a third tab "Sheet 3".

    Attached is an excel file which shows the task and the desired output.

    I am sure this is pretty basic but please help me as I am an absolute beginner regarding VBA.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: remove duplicates and delete empty cells

    Have you tried using Advanced Filter with the Unique Only and Copy to other location feature?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    07-06-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: remove duplicates and delete empty cells

    It must be a macro...

  4. #4
    Registered User
    Join Date
    07-06-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: remove duplicates and delete empty cells

    I have a code (below) but it doesn't fully work the way I like it to.

    Sub Unique_List()
    Dim ws1 As Worksheet: Set ws1 = Sheets("sheet1")
    Dim ws2 As Worksheet: Set ws2 = Sheets("Sheet2")

    Application.ScreenUpdating = False
    ws1.Range("B1:B" & ws1.Range("B" & Rows.Count).Row).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ws2.Range("B1"), Unique:=True
    With ws2
    .AutoFilterMode = False
    .Range("B1:B" & .Range("B" & Rows.Count).Row).AutoFilter 1, "="
    .Range("B2:B" & .Range("B" & Rows.Count).Row).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    .AutoFilterMode = False
    End With
    Application.ScreenUpdating = True

    End Sub

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: remove duplicates and delete empty cells

    Have you tried Advanced Filter, while recording a macro?

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: remove duplicates and delete empty cells

    Alternative
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-06-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: remove duplicates and delete empty cells

    Seems to work, thanks. can you please send me the code so that if a filter set in sheet1 it still applies to all the hidden values as well?

    thanks so much in advance.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: remove duplicates and delete empty cells

    It should, just test it for yourself.

+ 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 find duplicates, concatenate cells, then delete old duplicates
    By givemepuppies in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-04-2016, 02:43 AM
  2. [SOLVED] Delete duplicates and delete empty cells
    By Mengo85 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2015, 07:25 PM
  3. Replies: 0
    Last Post: 06-30-2015, 06:42 PM
  4. remove duplicates cells not delete the row vba
    By lupingamon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2014, 05:55 AM
  5. [SOLVED] Remove Duplicates but Dont delete the rows
    By sagar007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-27-2013, 07:35 AM
  6. [SOLVED] Remove Duplicates in Columns but also delete Row
    By iteriwarren in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 08-21-2012, 09:21 AM
  7. remove duplicates and delete cells...
    By OfficerSpock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2009, 02:59 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