Revision: 72676
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 18, 2017 21:06 by buglilorenzo
Initial Code
Sub ImportFromText(x As Integer, y As Integer, filename As String) Dim base As String Dim WS As Worksheet Dim WB As Workbook Set WB = ThisWorkbook Set WS = WB.Worksheets("Results") base = ThisWorkbook.PATH file_path = base & "\output\" & filename Open file_path For Input As #1 r = x Do Until EOF(1) Line Input #1, Data v = Split(Data, vbTab) For i = 0 To 3 Step 1 If r = x Then WS.Range("AA2").Offset(r, y + i) = v(i) Else WS.Range("AA2").Offset(r, y + i) = Round(CDbl(v(i)), 5) End If Next i r = r + 1 Loop Close #1 End Sub Sub import_modified_files() Call ImportFromText(0, 0, "Stream number 1 - stream function 0,0000.txt") Call ImportFromText(0, 4, "Stream number 2 - stream function 0,2500.txt") Call ImportFromText(0, 8, "Stream number 3 - stream function 0,5000.txt") Call ImportFromText(0, 12, "Stream number 4 - stream function 0,7500.txt") Call ImportFromText(0, 16, "Stream number 5 - stream function 1,0000.txt") End Sub
Initial URL
Initial Description
Read data from TXT files to import them in Excel environment
Initial Title
Read data from txt files
Initial Tags
excel
Initial Language
Visual Basic