• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Remove duplicates, spaces from Column A and paste value to B1

koskesh

Member
Hi, I need a fairly simple macro

The macro should

- look at column A

A
333
444

555
666

- remove duplicates
- remove spaces

And paste everything from column A into B1 and seperate them with a semicolon instead of space
333;444;555;666

Hope its clear

Thanks!!
 
I'd suggest you upload sample workbook, with data set that represent your actual data (i.e. desensitize data, but keep exactly the same data type and structure).

As well, this can easily be done using PowerQuery. Do you have access to it?
 
Something like below. Assuming Windows machine.

Code:
Sub Demo()
Dim cel As Range

With CreateObject("Scripting.Dictionary")
    For Each cel In Range("B3:B" & Cells(Rows.Count, 2).End(xlUp).Row).Cells
        If Len(cel.Value) > 0 Then
            .Item(cel.Value) = 1
        End If
    Next
    [E3].Value = Join(.Keys, ";")
End With

End Sub
 
Back
Top