Results 1 to 11 of 11

Remove Duplicates Without shifting cells VBA

Threaded View

  1. #1
    Registered User
    Join Date
    04-27-2019
    Location
    Los Angeles,CA
    MS-Off Ver
    Office 2010
    Posts
    21

    Remove Duplicates Without shifting cells VBA

    I'm trying to remove duplicates using VBA macro. Columns a,b,c and d on my sheet all have duplicate text that needs to be removed without shifting cells. After searching I was able to find the VBA macro below but I need to select a range every time. I need to streamline it to only be done once. Can someone please help? Thanks

    Remove.png



    Sub RemoveDuplicates()
    'UpdatebyExtendoffice20160918
     
        Dim xRow As Long
        Dim xCol As Long
        Dim xrg As Range
        Dim xl As Long
        On Error Resume Next
        Set xrg = Application.InputBox("Select a range:", "Kutools for Excel", _
                                        ActiveWindow.RangeSelection.AddressLocal, , , , , 8)
     
        xRow = xrg.Rows.Count + xrg.Row - 1
        xCol = xrg.Column
        'MsgBox xRow & ":" & xCol
        Application.ScreenUpdating = False
        For xl = xRow To 2 Step -1
            If Cells(xl, xCol) = Cells(xl - 1, xCol) Then
                Cells(xl, xCol) = ""
            End If
        Next xl
        Application.ScreenUpdating = True
         
    End Sub
    Attached Files Attached Files
    Last edited by MiglA06; 06-29-2020 at 03:49 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA code to remove duplicates without shifting cells
    By belpal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2018, 08:59 PM
  2. Excel 2003 vba Add and remove from listbox shifting cells up when removed
    By Ditch1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2017, 11:26 PM
  3. [SOLVED] Combine cells and remove duplicates
    By deanblew in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-27-2016, 10:09 AM
  4. Remove cells if duplicates found
    By garnerseo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-18-2013, 08:54 AM
  5. [SOLVED] Find Duplicates and add columns while shifting the cells up
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2013, 09:07 AM
  6. [SOLVED] concatinate cells and remove duplicates
    By wellsw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2013, 07:54 PM
  7. Formatting cells to remove duplicates
    By benmcfall in forum Excel General
    Replies: 0
    Last Post: 09-18-2009, 09:45 AM

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