Excel VBA 質問スレ Part76at TECH
Excel VBA 質問スレ Part76 - 暇つぶし2ch997:デフォルトの名無しさん (アウアウウー Sa09-DHlW)
22/07/15 08:08:12 DqNyEc18a.net
>>964
複数回現れる単語を削除すればいいのか?
Sub X964()
Dim Sheet As Worksheet: Set Sheet = ...
Dim Dictionary As Object: Set Dictionary = CreateObject("Scripting.Dictionary")
Dim LastRow As Long: LastRow = SheetSheet.Cells(Rows.Count, "A").End(xlUp).Row
Dim Row As Long
For Row = 1 To LastRow
Dim Word As Variant
For Each Word In Split(Sheet.Cells(Row, "A").Value, " ")
If Dictionary.Exists(Word) Then
Dictionary(Word) = Dictionary(Word) + 1
Else
Dictionary.Add Word, 1
End If
Next
Next
For Row = 1 To LastRow
Dim Uniques As String: Uniques = ""
For Each Word In Split(Sheet.Cells(Row, "A").Value, " ")
If 1 < Dictionary(Word) Then
If Uniques = "" Then
Uniques = Word
Else
Uniques = Uniques & " " & Word
End If
End If
Next
Sheet.Cells(Row, "B").Value = Uniques
Next
End Sub


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch