devxlogo

Get the Last Filled Row or Column in Any Excel Spreadsheet

Sometimes you need to know which is the last row or column in an Excel sheet that contains actual data. To do that, use the following code:

' Find last filled column in Excel sheeti_col = XL_PlyWorksheet.cells(1, "A").End(xlToRight).Column' Find last filled row in Excel sheeti_row = XL_PlyWorksheet.Range("A65536").End(xlUp).Row

Don’t forget to add a reference to Excel, or you’ll get a compile-time error.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.