Dave,

Here are some relevant code snips:

To add as a worksheet instead of as a new file:

           Worksheets.Add after:=Worksheets(Worksheets.Count)
           ActiveSheet.Name = "a new sheet"

Now to parse:

Sub LoadTheSheet()
Dim intRowNo As Integer
   Dim strLastLine As String, strLineIn As String
Cells.Font.Name = "Fixedsys"
   Range("A1").Select
   Application.ScreenUpdating = False
   intRowNo = 0
   Open pvarFileToOpen(pintCounter) For Input As #1
Do While Not EOF(1)
       Line Input #1, strLineIn
           intRowNo = intRowNo + 1
           Cells(intRowNo, 1).Value = strLineIn
       strLastLine = strLineIn
   Loop
Close #1
   ParseColumns
Application.ScreenUpdating = True

End Sub

'------------------------------------------------------------------------------
'   ParseColumns - Split the Data in the One Column into Several.
'------------------------------------------------------------------------------
Sub ParseColumns()

   Dim arrColumns As Variant
arrColumns = Array(Array(0, 1), Array(30, 1), Array(40, 1), Array(50, 1), _ Array(60, 1), Array(70, 1), Array(80, 1), Array(90, 1), Array(100, 1), _
       Array(110, 1), Array(120, 1))
Range("a7:a200").Select 'Data always starts at row 7 Selection.TextToColumns Destination:=Range("A7"), DataType:=xlFixedWidth, _
       fieldinfo:=arrColumns
   Selection.Columns("a:p").AutoFit
   Range("a1").Select

End Sub

You would modify the ParseColumns routine to set the column widths accordingly.

Bill


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.