View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Vlad999[_16_] Vlad999[_16_] is offline
external usenet poster
 
Posts: 1
Default Import and Split CSV - 2


Thanks you've helped me before havent you, I remember the name thanks a
lot.

I used the code that you provided below but it says "Compile error
bolck if without end if" how do i correct this this?



Code:
--------------------
Sub WriteFile()
Dim ff As Long, j As Long
Dim v As Variant
ff = FreeFile()
ReDim v(1 To 10)
Set bk = Workbooks.Add(xlWBATWorksheet)
Open "C:\Test.Txt" For Input As #ff
Line Input #ff, l
j = 0
Do While Not EOF(ff)
j = j + 1
Line Input #ff, l
If Len(Trim(l)) < 1 Then
Worksheets.Add After:=bk.Worksheets( _
bk.Worksheets.Count)
ActiveSheet.Name = v(1)
ActiveSheet.Range("A1:J1").Value = v
ReDim v(1 To 10)
j = 0
Else
v(j) = l
End If
Loop
If Len(Trim(v(1))) 0 Then
Worksheets.Add After:=bk.Worksheets( _
bk.Worksheets.Count)
ActiveSheet.Name = v(1)
ActiveSheet.Range("A1:J1").Value = v
End Sub
--------------------


--
Vlad999
------------------------------------------------------------------------
Vlad999's Profile: http://www.excelforum.com/member.php...o&userid=33586
View this thread: http://www.excelforum.com/showthread...hreadid=545708