Large import

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

We have a list of 191000 records in a CSV format that we
want to import into excel...the problem is that it imports
them straight down, reaches 65000 and does not import the
rest of the records. Is there any way to force excel to
import this into 10 columns, then go down?

Thanks!
 
Tim said:
We have a list of 191000 records in a CSV format that we
want to import into excel...the problem is that it imports
them straight down, reaches 65000 and does not import the
rest of the records. Is there any way to force excel to
import this into 10 columns, then go down?

Thanks!

I am not quite sure what your file format is? You say CSV but you imply
maybe only one item per record. I have assumed that for simplicity, so the
VBA code below may need a bit of editing. Also, this code runs very slowly,
and I am not sure why. So it may take a while to process your file.

Regards

Geoff


Public Sub Readin()

Dim Mynum As String
Dim MyCell As Long
Dim MyRow As Long
Dim MyCol As Long


MyCell=0


Open "C:\Mydata.csv" For Input As #1


While Not EOF(1)

Input #1, Mynum

'Work out where to put it
MyRow = Int(MyCell/10)
MyCol = MyCell - 10*MyRow


Range("B2")(MyRow, MyCol).Value = Mynum

MyCell = MyCell + 1

Wend

Close #1
End Sub
 
Thank you very much!!!

-----Original Message-----



I am not quite sure what your file format is? You say CSV but you imply
maybe only one item per record. I have assumed that for simplicity, so the
VBA code below may need a bit of editing. Also, this code runs very slowly,
and I am not sure why. So it may take a while to process your file.

Regards

Geoff


Public Sub Readin()

Dim Mynum As String
Dim MyCell As Long
Dim MyRow As Long
Dim MyCol As Long


MyCell=0


Open "C:\Mydata.csv" For Input As #1


While Not EOF(1)

Input #1, Mynum

'Work out where to put it
MyRow = Int(MyCell/10)
MyCol = MyCell - 10*MyRow


Range("B2")(MyRow, MyCol).Value = Mynum

MyCell = MyCell + 1

Wend

Close #1
End Sub


.
 
Back
Top