Home > database >  Is there a way to set a limit to Excel's maximum row limit of 1,048,576
Is there a way to set a limit to Excel's maximum row limit of 1,048,576

Time:11-02

I noticed through a mistake when completing an excel task that the maximum row limit is 1,048,576. Is there a setting or some VBA that can limit an excel workbook to have a maximum row limit of less than 1,048,576?

For example, lets say I have a workbook that really would never go above 2,000 records. Is there a way to set it so that no matter what, a record greater than number 2,000 could not exist?

Looked all over online, could only see users wanting to increase the limit!

CodePudding user response:

One option is to protect (and optionally hide) all rows past 2000. As regards the concerns raised in the excellent comments:

  • When protecting the sheet, disallow inserting new rows.
  • The protected rows are not included in the sheet's .UsedRange.
  • In testing, the file size only increased by several KB, so no concerns there.
  • Related