Results 1 to 14 of 14

Removing repeated text across several cells (same column) and keeping first instance

Threaded View

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

    Re: Removing repeated text across several cells (same column) and keeping first instance

    try
    Sub test()
        Dim a, e, x, i As Long, ii As Long, s As String, myList
        ReDim myList(1 To 10000)
        With [b3].CurrentRegion
            a = .Value
            For i = 2 To UBound(a, 1)
                x = Split(a(i, 1), vbLf)
                a(i, 1) = ""
                For Each e In x
                    s = UCase$(Trim$(Mid$(Trim$(e), 2)))
                    For ii = 1 To UBound(myList)
                        If myList(ii) = s Then Exit For
                        If myList(ii) = "" Then
                            a(i, 1) = a(i, 1) & IIf(a(i, 1) <> "", vbLf, "") & e
                            myList(ii) = s: Exit For
                        End If
                    Next
                Next
            Next
            .Value = a
        End With
    End Sub
    Last edited by jindon; 11-26-2022 at 04:33 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Remove Duplicate - Specific instance but keeping data from removed instance?
    By NewYears1978 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-22-2022, 12:59 PM
  2. [SOLVED] Removing duplicates from column A while keeping their respective values from column B
    By joel.mugabe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-19-2016, 02:38 AM
  3. Finding the last instance of a text in a column and deleting all cells with values af
    By devirecui in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2015, 07:31 AM
  4. Removing Merged cells keeping entries order
    By Odracir in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-29-2015, 02:21 AM
  5. Formula for counting text values in column when value is repeated in cells
    By Blubirdjim in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-11-2012, 12:36 PM
  6. Removing Formulas keeping Values as Text
    By dsexpress in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2009, 10:45 AM
  7. Removing all text from a column of cells
    By jimbob in forum Excel General
    Replies: 3
    Last Post: 02-07-2009, 05:14 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