Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi ng. Using xl 2003 I need to import first 9 chars from every line in text file and outpu beginning at A2 and down til EOF of text file. Current file has 9500 lines, but will vary weekly Here's my current code: Sub Import_Test() Dim datafile$ Dim a1 As String * 9 datafile$ = "C:\emory_fv\emory_fv.txt" On Error GoTo DiskError Open datafile$ For Input As #1 Sheet1.Activate With Range("A1") Do While Not EOF(1) Input #1, a1 .Offset(srow, 0) = a1 srow = srow + 1 Loop End With Close #1 Exit Sub DiskError: a = MsgBox("Disk Error." & Err.Number, vbExclamation) End Su -- gos ----------------------------------------------------------------------- goss's Profile: http://www.excelforum.com/member.php...nfo&userid=460 View this thread: http://www.excelforum.com/showthread.php?threadid=27889 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Import_Test()
Dim datafile$ Dim a1 As string Dim sRow as Long datafile$ = "C:\emory_fv\emory_fv.txt" On Error GoTo DiskError Open datafile$ For Input As #1 Sheet1.Activate With Range("A1") Do While Not EOF(1) Line Input #1, a1 srow = srow + 1 .Offset(srow, 0).value = left(a1,9) Loop End With Close #1 Exit Sub DiskError: a = MsgBox("Disk Error." & Err.Number, vbExclamation) End Sub -- Regards, tom Ogilvy "goss" wrote in message ... Hi ng. Using xl 2003 I need to import first 9 chars from every line in text file and output beginning at A2 and down til EOF of text file. Current file has 9500 lines, but will vary weekly Here's my current code: Sub Import_Test() Dim datafile$ Dim a1 As String * 9 datafile$ = "C:\emory_fv\emory_fv.txt" On Error GoTo DiskError Open datafile$ For Input As #1 Sheet1.Activate With Range("A1") Do While Not EOF(1) Input #1, a1 Offset(srow, 0) = a1 srow = srow + 1 Loop End With Close #1 Exit Sub DiskError: a = MsgBox("Disk Error." & Err.Number, vbExclamation) End Sub -- goss ------------------------------------------------------------------------ goss's Profile: http://www.excelforum.com/member.php...fo&userid=4602 View this thread: http://www.excelforum.com/showthread...hreadid=278899 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count partial matched text string | New Users to Excel | |||
auto bold partial text in a string | Excel Discussion (Misc queries) | |||
Import txt file with multiple rows for each record | Excel Discussion (Misc queries) | |||
How to import a text file to Excel treating all input content are in string. | Excel Discussion (Misc queries) | |||
searching a string with a partial string | Excel Programming |