I have a Raw data that will parse using VB6
and get only the specific data, I already get the specific data. My problem now is this. I use writeline
to write the specif data into another Excel/CSV file. My problem is this, I can already write the data in the CSV/ Excel file but it is written only in the first column so the tendency is all the data will write in the first column only. Can someone please help me, how can I make in per column? for example the first line that needed is in the first column and after that the second line is in the second column and so and so forth. Thank you in advance for the help :)
below is my code.
Dim i, ii, num As Long
Dim ff As Integer
Dim sText As String
Dim itmX As ListItem
Dim x, y As Integer
Dim ex As Excel.Application
Dim sheet As Excel.Workbook
Dim Csheet As Excel.Range
Dim wsheet As Excel.Worksheet, snum As Long
Dim strTransform() As String
Dim strTemp() As String
Dim intI As Integer
Dim intJ As Integer
Dim intMax As Integer
Dim p(29) As String
Dim adata() As String
Dim time1() As String
Dim holder1, holder2, holder3
Dim time2() As String
Dim lngIndex As Integer
Dim lngIndexx As Integer
Dim totaltime() As String
Dim myFSOww As New FileSystemObject
Dim myFSOr As New FileSystemObject
Dim myFSOw
Dim ft1 As TextStream
Dim ts, ts2, ts3, ft2, r, a, b, z, c, minus, time_num1, time_num2, time_num3, time_num4, comp
Dim date_num1, date_num2, d_t, total_parse, flow_total, req_flow, aia, air, cer, cla, clr, dsa
Dim dsr, dwa, dwr, ida, idr, noa, nor, pua, pur, rsa, rsr, ula, ulr
Set myFSOw = myFSOww.GetFile("C:\Users\user\Documents\bebe folder\Projects SSD\LTE Raw Data\Peek_data.csv")
Set myFSOr = CreateObject("Scripting.FileSystemObject")
Set ts = myFSOr.GetFile(txtfilename.Text)
Set ft1 = ts.OpenAsTextStream(ForReading, TristateUseDefault)
Set ft2 = myFSOw.OpenAsTextStream(ForWriting)
Do Until ft1.AtEndOfStream
On Error Resume Next
a = ft1.ReadLine
b = a
p(0) = a
r = r + 1
Text1.Text = r
z = Left(b, 1)
If Not IsNumeric(z) Then
adata = Split(a, ",")
For i = 0 To UBound(adata)
Text3 = adata(i)
If Text3 <> "Time Stamp" And txt_tag = Empty Then
ft2.WriteLine Text3
End If
Next
txt_tag = 1
Else
'FOR TIME
p0 = "00:00"
p1 = "01:00"
p2 = "02:00"
p3 = "03:00"
p4 = "04:00"
p5 = "05:00"
p6 = "06:00"
p7 = "07:00"
p8 = "08:00"
p9 = "09:00"
p11 = "11:00"
p12 = "12:00"
p13 = "13:00"
p14 = "14:00"
p16 = "16:00"
p17 = "17:00"
p18 = "18:00"
p19 = "19:00"
p20 = "20:00"
p21 = "21:00"
p22 = "22:00"
p23 = "23:00"
h1 = "1:00"
h2 = "2:00"
h3 = "3:00"
h4 = "4:00"
h5 = "5:00"
h6 = "6:00"
h7 = "7:00"
h8 = "8:00"
h9 = "9:00"
If holder1 = "" Then
time1 = Split(a, ",")
For lngIndex = 0 To UBound(time1)
holder1 = time1(lngIndex)
If holder1 = time1(1) Then
txt_dt = holder1
If Len(txt_dt) = 19 Then
txt_t = Right(txt_dt, 8)
txt_d = Left(txt_dt, 10)
txt_t = Left(txt_t, 5)
ElseIf Len(txt_dt) = 14 Then
txt_t = Right(txt_dt, 4)
txt_d = Left(txt_dt, 10)
ElseIf Len(txt_dt) = 15 Then
txt_t = Right(txt_dt, 5)
txt_d = Left(txt_dt, 10)
End If
txt_trm = Trim(txt_t)
txt_t = txt_trm
If txt_t = p0 Or txt_t = p1 Or txt_t = p2 Or txt_t = p3 Or txt_t = p4 Or txt_t = p5 Or txt_t = p6 Or txt_t = p7 Or txt_t = p8 _
Or txt_t = p9 Or txt_t = p10 Or txt_t = p11 Or txt_t = p12 Or txt_t = p13 Or txt_t = p14 Or txt_t = p15 Or txt_t = p16 _
Or txt_t = p17 Or txt_t = p18 Or txt_t = p19 Or txt_t = p20 Or txt_t = p21 Or txt_t = p22 Or txt_t = p23 _
Or txt_t = h1 Or txt_t = h2 Or txt_t = h3 Or txt_t = h4 Or txt_t = h5 Or txt_t = h6 Or txt_t = h7 Or txt_t = h8 _
Or txt_t = h9 Then
holder1 = time1(lngIndex)
Else
holder1 = ""
GoTo 1
End If
End If
Next lngIndex
Else
time2 = Split(a, ",")
For lngIndexx = 0 To UBound(time2)
holder2 = time2(lngIndexx)
If holder2 = time2(1) Then
txt_dt = holder2 'this is my time
If Len(txt_dt) = 19 Then
txt_t = Right(txt_dt, 8)
txt_d = Left(txt_dt, 10)
txt_t = Left(txt_t, 5)
ElseIf Len(txt_dt) = 14 Then
txt_t = Right(txt_dt, 4)
txt_d = Left(txt_dt, 10)
ElseIf Len(txt_dt) = 15 Then
txt_t = Right(txt_dt, 5)
txt_d = Left(txt_dt, 10)
End If
txt_trm = Trim(txt_t)
txt_t = txt_trm
If txt_t = p0 Or txt_t = p1 Or txt_t = p2 Or txt_t = p3 Or txt_t = p4 Or txt_t = p5 Or txt_t = p6 Or txt_t = p7 Or txt_t = p8 _
Or txt_t = p9 Or txt_t = p10 Or txt_t = p11 Or txt_t = p12 Or txt_t = p13 Or txt_t = p14 Or txt_t = p15 Or txt_t = p16 _
Or txt_t = p17 Or txt_t = p18 Or txt_t = p19 Or txt_t = p20 Or txt_t = p21 Or txt_t = p22 Or txt_t = p23 _
Or txt_t = h1 Or txt_t = h2 Or txt_t = h3 Or txt_t = h4 Or txt_t = h5 Or txt_t = h6 Or txt_t = h7 Or txt_t = h8 _
Or txt_t = h9 Then
holder2 = time2(lngIndexx)
Else
holder2 = ""
GoTo 1
End If
End If
Next lngIndexx
End If
'subtract array time1 from time2
1
If holder1 <> "" And holder2 <> "" Then
For lngIndex = 0 To UBound(time2)
holder3 = time2(lngIndex) - time1(lngIndex)
If write1 = 0 And lngIndex = 1 Then
ft2.WriteLine time2(1)
write1 = 1
ElseIf write1 = 1 And lngIndex <> 1 Then
ft2.WriteLine holder3
End If
Next
ft2.WriteBlankLines 1
End If
write1 = 0
End If
DoEvents
Loop
List1.AddItem Format(Now, "YYYY-MM-DD HH:MM:SS") & " Time end"
Set ft2 = Nothing