将拼写错误的单词复制到相邻的列(s)

我有一个列中的关键字列表。 我需要插入任何拼写错误的单词到相邻的单元格手动审查。 只有拼写错误的单词,而不是整个单元格。

这个VBA脚本让我大部分的方式,但我不知道如何复制拼写错误的单词。 偏移(0,1)出错,但偏移(1,0)起作用。 WTH?

现在我会很高兴,只是第一个拼写错误的单词被复制,但如果它可以循环,并将它们全部插入右侧的单元格,那就太棒了。

使用Excel VBA中的VBA代码删除行如果拼写错误的话

Sub DeleteMispelledCells() Dim lRow As Long, cl As Range With ActiveSheet For lRow = .UsedRange.Rows.Count To 1 Step -1 For Each cl In .Rows(lRow) If Not IsEmpty(cl) Then If Not Application.CheckSpelling(Word:=cl.Text) cl.Copy cl.Offset(1, 0).Insert 'The Offset(0, 1) throws an error. Why? Application.CutCopyMode = False Exit For End If End If Next cl Next lRow End With End Sub 

试试这个小UDF()

 Public Function CheckPhrase(r As Range) As String Dim MyText As String, ary, a MyText = LCase(r(1).Text) MyText = FixUp(MyText) ary = Split(MyText, " ") Dim oxlAp As Object Set oxlAp = CreateObject("Excel.Application") CheckPhrase = "" For Each a In ary If Not oxlAp.CheckSpelling(a) Then CheckPhrase = CheckPhrase & vbCrLf & a End If Next a oxlAp.Quit Set oxlAp = Nothing End Function Public Function FixUp(sin As String) As String Dim t As String, ary, a t = sin ary = Array(",", ".", ";", ":""'") For Each a In ary t = Replace(t, a, "") Next a FixUp = t End Function 

例如:

在这里输入图像说明

注意:

打开包含UDF()的单元格中的文本换行。