Ich bin sehr neu in VBA. Unten ist mein Code, um nur die Punkte zu identifizieren und zu entfernen, die nach Datumsangaben und nicht nach dem Text erscheinen. Aber es scheint nicht zu funktionieren.
Sub simpleRegexSearch()
Dim strPattern As String: strPattern = "[0-9]+[\.]"
Dim strReplace As String: strReplace = "\."
Dim myreplace As Long
Dim strInput As String
Dim Myrange As Range
Set regEx = CreateObject("VBScript.RegExp")
Set Myrange = ActiveSheet.Range("A1")
For Each cell In Myrange
If strPattern <> "" Then
strInput = cell.Value
With regEx
.Global = True
.MultiLine = True
.IgnoreCase = False
.Pattern = strPattern
End With
If regEx.TEST(strInput) Then
Myrange.Value = (regEx.Replace(strInput, strReplace))
End If
End If
Next
Set regEx = Nothing
End Sub
Beispiel zwei Zeilen der Spalte, an der ich arbeite:
08-02-18. BM sent email to Matt with IM. 15-02-18. Left voice message for Matt today.
08-02-18. BM sent email with IM. 15-2-18. BM spoke to Adam. He is looking at the IM. 16-2-18. Further discussions with Adam today. Looking to develop an office asset with Childcare.
Die gewünschte Ausgabe ist: -
08-02-18 BM sent email to Matt with IM. 15-02-18 Left voice message for Matt today.
08-02-18 BM sent email with IM. 15-2-18 BM spoke to Adam. He is looking at the IM. 16-2-18 Further discussions with Adam today. Looking to develop an office asset with Childcare.
Bitte hilf mir bei der Korrektur drin.