Excel for Signalling

1) First, Separate log

Assume this text is in A1: 07/07/2026 00:00:09 - H,07072026,0000,


Datetime column

In B1: =LEFT(A1,FIND(" - ",A1)-1)

Result: 07/07/2026 00:00:09


Message column

In C1: =MID(A1,FIND(" - ",A1)+3,LEN(A1))

Result: H,07072026,0000,




2) VBA auto delete

Press Alt + F11 → Insert → Module → paste this:



Sub DeleteUnwantedLogRows_ByMessageColumn_Fixed() Dim ws As Worksheet Dim lastRow As Long Dim i As Long Dim msgText As String Set ws = ActiveSheet lastRow = ws.Cells(ws.Rows.Count, "B").End(xlUp).Row For i = lastRow To 1 Step -1 ' Skip kalau cell ada error value If Not IsError(ws.Cells(i, "B").Value) Then msgText = CStr(ws.Cells(i, "B").Value) If InStr(1, msgText, "All messages processed", vbTextCompare) > 0 _ Or InStr(1, msgText, "Transaction", vbTextCompare) > 0 _ Or InStr(1, msgText, "Master timetable message detected", vbTextCompare) > 0 _ Or InStr(1, msgText, "RailML type", vbTextCompare) > 0 _ Or InStr(1, msgText, "Master timetable processing completed", vbTextCompare) > 0 Then ws.Rows(i).Delete End If End If Next i MsgBox "Unwanted rows deleted successfully." End Sub


Then run the macro.

This will delete any row in Column A that contains



Ulasan

Catatan popular daripada blog ini

SISTEM PENGOPERASIAN KOMPUTER (OS)

APA ITU STRUCTURED QUERY LANGUAGE (SQL)

APA ITU ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE) ?