suppose you have want to keep unique words in a cell
Like a1 is having ashish ashish koul
and i want only ashish koul as result ( remove duplicate words in cell) try the below function
check the snapshot
Here is the code:-
Function uniquetext(x As String)
Dim s As String
Dim jj, kk As Integer
Dim bl As Boolean
kk = 0
y = Split(x)
For i = LBound(y) To UBound(y)
bl = False
'jj = 0
For j = LBound(y) To i - 1
If y(i) = y(j) Then
bl = True
End If
' If jj >= kk Then
' Exit For
' End If
' kk = jj + 1
Next j
If bl = False Then
s = s & " " & y(i)
End If
Next i
uniquetext = Application.WorksheetFunction.Trim(s)
End Function
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
If you want to copy the data from pdf file to Excel. Sub method1_using_sendkey() Dim task ' open the file ' change the path of ...
-
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
No comments:
Post a Comment