If You have Wrong KeyWord in Your data and You want to Get them on Another Worksheet You can Use this Code
Public MyTest As Boolean
Public myWord As String
Sub GetText()
On Error Resume Next
Dim ws As Worksheet
Dim st As String
Dim arr() As String
Dim cell As Range
Set ws = ActiveSheet
Sheets("WrongWord").Delete
Sheets.Add.Name = "WrongWord"
ws.Activate
st = ""
For Each cell In ActiveSheet.UsedRange
st = st & " " & cell.Value
Next
arr = Split(st, " ")
For i = LBound(arr) To UBound(arr)
myWord = arr(i)
Call mySpell
If MyTest = False Then Sheets("WrongWord").Range("A" & Sheets("WrongWord").Range("A20000").End(xlUp).Row + 1).Value = myWord
MyTest = False
Next
Sheets("WrongWord").Activate
MsgBox "Total " & WorksheetFunction.CountA(ActiveSheet.Cells) & " Wrong Word Found in Data ", vbInformation
End Sub
Sub mySpell()
MyTest = Application.CheckSpelling(myWord)
End Sub
Public MyTest As Boolean
Public myWord As String
Sub GetText()
On Error Resume Next
Dim ws As Worksheet
Dim st As String
Dim arr() As String
Dim cell As Range
Set ws = ActiveSheet
Sheets("WrongWord").Delete
Sheets.Add.Name = "WrongWord"
ws.Activate
st = ""
For Each cell In ActiveSheet.UsedRange
st = st & " " & cell.Value
Next
arr = Split(st, " ")
For i = LBound(arr) To UBound(arr)
myWord = arr(i)
Call mySpell
If MyTest = False Then Sheets("WrongWord").Range("A" & Sheets("WrongWord").Range("A20000").End(xlUp).Row + 1).Value = myWord
MyTest = False
Next
Sheets("WrongWord").Activate
MsgBox "Total " & WorksheetFunction.CountA(ActiveSheet.Cells) & " Wrong Word Found in Data ", vbInformation
End Sub
Sub mySpell()
MyTest = Application.CheckSpelling(myWord)
End Sub
No comments:
Post a Comment