Dear all Mates,
Kindly arrange the small modification in existing code.this code is developed many weeks back by well wisher from this site.
My Code as below:
Sub test()
Dim fn As String, txt As String, n As Long, m As Object, mtch As Object, sm As Object, a()
fn = Application.GetOpenFilename("TextFiles,*.anl")
If fn = "False" Then Exit Sub
txt = CreateObject("Scripting.FileSystemObject").OpenTextFile(fn).ReadAll
With CreateObject("VBScript.RegExp")
.Global = True: .MultiLine = True
.Pattern = "^ *=+(\r\n)([^=]+\r\n)+"
Set mtch = .Execute(txt)
ReDim a(1 To mtch.Count)
.Pattern = "^ +(.*?) +N O\. +(\d+)(.*\r\n){4}.*?: +(\d+\.\d+).*?: +(\d+\.\d+).*?X +(\d+\.\d+).*"
For Each m In mtch
If .test(m) Then
n = n + 1: Set sm = .Execute(m)(0).submatches
a(n) = Array(n, sm(0), sm(1), sm(3), sm(4), sm(4))
End If
Next
End With
If n > 0 Then
ReDim Preserve a(1 To n)
[a2].Resize(n, 6).Value = Application.Index(a, 0, 0)
End If
End Sub
with help of above code developing excel file, and required modification is mentioned in sample excel file.and text file also attached.please find the attachments
Kindly modify the Code
Thanking you,
Best regards.
Bookmarks