Yes, that 65,536 rows maximum in Excel is true

I was exporting into Excel a list of users and the files they “owned” in a selected directory when I ran into an error at row 65,537 in the Excel sheet.

Dim shWorkSheet As Excel.Worksheet = DirectCast(bkWorkBook.Sheets("Sheet1"), Excel.Worksheet)
...
For Each File As System.IO.FileInfo In FileCollection(i - 1).FileList
        shWorkSheet.Cells(RowCounter, 2).Value = File.FullName
        shWorkSheet.Cells(RowCounter, 3).Value = File.Length
        RowCounter += 1
Next

So 65,536 was the last row successfully added to the Excel sheet. That number sounded familiar, so I diligently checked and found an MSDN article on Excel. And there, plain as day, was:

A Microsoft Office Excel worksheet contains 65,536 rows and 256 columns.

So I guess I’ll be splitting my records between different sheets. At least it was an easy error to diagnose.

Advertisements
  1. #1 by TG on October 26, 2010 - 5:20 pm

    I heard that they upped that limit in Excel 2007 and removed it completely in 2010.

  2. #2 by cnl78 on February 15, 2011 - 10:40 pm

    Running into this same issue with C# Excel Automation….and I do have Excel 2007. Referencing the Microsoft Excel 12.0 Object Library.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: