I like this way:
ActiveSheet.UsedRange.Rows.Count
The same can be done with columns count. For me, always work. But, if you have data in another column, the code above will consider them too, because the code is looking for all cell range in the sheet.
More Related Contents:
- Clean up Excel Interop Objects with IDisposable
- The proper way to dispose Excel com object using VB.NET?
- VB.Net – Excel COM Object not getting released [duplicate]
- VB.NET Excel Program Leaves EXCEL.EXE floating after completion
- How to loop through all the properties of a class?
- Case insensitive string compare in LINQ-to-SQL
- Does XSLT have a Split() function?
- Fastest method to remove Empty rows and Columns From Excel Files using Interop
- Pick unique Random numbers
- Which is generally best to use — StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?
- Calling a .net library method from vba
- System.Runtime.InteropServices.COMException (0x800A03EC)
- How do I validate email address formatting with the .NET Framework?
- Does this code prevent SQL injection?
- Option Strict On and .NET for VB6 programmers
- RestSharp serialization to JSON, object is not using SerializeAs attribute as expected
- Windows 7 .net Excel .SaveAs() Error Exception from HRESULT: 0x800A03EC
- Translate a column index into an Excel Column Name
- How to print datagridview table with its header in vb.net?
- How to draw a signature and save it to disc as a Bitmap?
- How to convert date format in vb.net?
- LinqToSql declare and instantiate DataContext best practice?
- Assigning a value to ComboBox Items
- Are nested Try/Catch blocks a bad idea?
- Shadows vs Overloads in VB.NET
- Custom button captions in .NET messagebox?
- .NET — Textbox control – wait till user is done typing
- How to post a file via HTTP post in vb.net
- How to securely store a connection string in a WinForms application?
- Visual Basic Capture output of cmd