hoguz2
04-26-2017, 05:10 AM
hi everyone ,
I would like your help..
my code as below ..
The first code works fine. I want to change first like an second. But I can't it. what is the wrong
Sub first()
On Error GoTo SonSatir
Dim LResult As String, Satir As Long, Kayit1 As String, Adress As String
Adress = "C:\Users\hoguz2\Desktop\hoguz\"
LResult = Dir(Adress & "ERKLDAG*.txt")
Satir = 1
While LResult <> ""
Open Adress & LResult For Input As 1
Do While Not EOF(1)
Line Input #1, Kayit1
If Kayit1 <> Empty Then
Cells(Satir, "A") = Kayit1
Satir = Satir + 1
End If
Loop
Close #1
LResult = Dir
Wend
Exit Sub
SonSatir:
MsgBox ("ERROR")
End Sub
second()
On Error GoTo SonSatir
Dim LResult As String, Satir As Long, Kayit1 As String, Adress As String
'Adress = "C:\Users\hoguz2\Desktop\hoguz\"
Adress = ThisWorkbook.Path
LResult = Dir(Adress & "\P000753288*.txt")
Satir = 1
While LResult <> ""
Open Adress & LResult For Input As 1
Do While Not EOF(1)
Line Input #1, Kayit1
If Kayit1 <> Empty Then
Cells(Satir, "A") = Kayit1
Satir = Satir + 1
End If
Loop
Close #1
LResult = Dir
Wend
Exit Sub
SonSatir:
MsgBox ("ERROR")
End Sub
I would like your help..
my code as below ..
The first code works fine. I want to change first like an second. But I can't it. what is the wrong
Sub first()
On Error GoTo SonSatir
Dim LResult As String, Satir As Long, Kayit1 As String, Adress As String
Adress = "C:\Users\hoguz2\Desktop\hoguz\"
LResult = Dir(Adress & "ERKLDAG*.txt")
Satir = 1
While LResult <> ""
Open Adress & LResult For Input As 1
Do While Not EOF(1)
Line Input #1, Kayit1
If Kayit1 <> Empty Then
Cells(Satir, "A") = Kayit1
Satir = Satir + 1
End If
Loop
Close #1
LResult = Dir
Wend
Exit Sub
SonSatir:
MsgBox ("ERROR")
End Sub
second()
On Error GoTo SonSatir
Dim LResult As String, Satir As Long, Kayit1 As String, Adress As String
'Adress = "C:\Users\hoguz2\Desktop\hoguz\"
Adress = ThisWorkbook.Path
LResult = Dir(Adress & "\P000753288*.txt")
Satir = 1
While LResult <> ""
Open Adress & LResult For Input As 1
Do While Not EOF(1)
Line Input #1, Kayit1
If Kayit1 <> Empty Then
Cells(Satir, "A") = Kayit1
Satir = Satir + 1
End If
Loop
Close #1
LResult = Dir
Wend
Exit Sub
SonSatir:
MsgBox ("ERROR")
End Sub