Try,
Hello, Try : Sub Import() Dim Enrgt As String, lgRow As Long, Tabl, inCol As Integer Dim inCalculationMode As Integer Application.ScreenUpdating = False inCalculationMode = Application.Calculation Application.Calculation = xlCalculationManual Sheets.Add Close #1 Open "d:\donnees\daniel\mpfe\TB.txt" For Input As #1 Do While Not EOF(1) Line Input #1, Enrgt Tabl = Split(Enrgt, " ") If Tabl(LBound(Tabl)) = "No" Then Line Input #1, Enrgt Tabl = Split(Enrgt, " ") lgRow = lgRow + 1 col = 7 For i = 47 To UBound(Tabl) If Tabl(i) <> "" Then col = col + 1 Cells(lgRow, col) = Tabl(i) End If Next i col = 0 Line Input #1, Enrgt Tabl = Split(Enrgt, " ") For i = 0 To 7 If Tabl(i) <> "" Then col = col + 1 Cells(lgRow, col) = Tabl(i) End If Next i Exit Do End If Loop Do While Not EOF(1) Line Input #1, Enrgt Tabl = Split(Enrgt, " ") col = 0 If UBound(Tabl) >= 0 Then If UBound(Tabl) > 0 And IsNumeric(Tabl(LBound(Tabl))) Then lgRow = lgRow + 1 For Each Item In Tabl If Item <> "" Then col = col + 1 Cells(lgRow, col) = Item End If Next Item End If End If Loop Close #1 Application.Calculation = inCalculationMode Application.ScreenUpdating = True End Sub Regards. Daniel De : excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] De la part de Prashant Envoyé : mardi 26 avril 2011 09:25 À : excel-macros@googlegroups.com Objet : $$Excel-Macros$$ Help on Macro Dear All, Find attached text file - tb report, I want to culture the data of the txt file, so that It can be used in excel. Desired output is shown in book-1. Need a marco to get desired output from text, automatically. Regards, Prashant -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel