Need VBA code snippet help...
The sample code I have doesn't do what I want (I'm sure it is not correct code):
Sub Sample()
Dim MyData As String
Dim lineData() As String, strData() As String, myFile As String
Dim i As Long, rng As Range
myFile = Application.GetOpenFilename("RawData1 (*.txt), *.txt")
Open myFile For Binary As #1
MyData = Space$(LOF(1))
Get #1, , MyData
Close #1
' Split into wholes line
lineData() = Split(MyData, vbNewLine)
Set rng = Range("A1")
' For each line
For i = 0 To UBound(lineData)
' Split the line
strData = Split(lineData(i), "|")
' Write to the sheet
rng.Offset(i, 0).Resize(1, UBound(strData) + 1) = strData
Next
End Sub
Appreciate any and all help please.
The datafile contents is like this (note . means a blank cell):
*notice #char (including the . adds up to 16 per line)
.2A.....5C.9..6G
6..G.5471A82.D..
.8...B2...E7...A
....6AE..4GF3.87
1E7.C8..G.46FBA9
.D.....4.E.3.CG.
.F.C.2A571B.683E
A.5..9...2.C7.D.
..3.A..9.8.4.EBD
..E6.G1D.....3..
C.....7..D1..A4.
DA.....63.7EC...
3...F.9....85G..
........EB..DF98
EB.A5..2...1....
F.9.B.8..75GA.2.
Many thanks,
Tim
-
codexmonkey -
[ 1 ] Thanks - Reply
{{ DiscussionBoard.errors[11268971].message }} -
-
tryinhere -
Thanks - Reply
Signature| > Choosing to go off the grid for a while to focus on family, work and life in general. Have a great 2020 < |{{ DiscussionBoard.errors[11269295].message }} -
-
Mike Anthony -
[ 1 ] Thanks - Reply
Signature{{ DiscussionBoard.errors[11269734].message }} -
-
tryinhere -
[ 1 ] Thanks - Reply
Signature| > Choosing to go off the grid for a while to focus on family, work and life in general. Have a great 2020 < |{{ DiscussionBoard.errors[11270349].message }} -
-
astaga -
[ 1 ] Thanks - Reply
{{ DiscussionBoard.errors[11271965].message }} -