Created
July 31, 2021 01:16
-
-
Save stevesohcot/1ed9c738dddf74c4313f30572139faf1 to your computer and use it in GitHub Desktop.
VBA Excel - Get Row Count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Public Function HowManyRows(sheetName As String) As Long | |
| 'Find out how many row there are | |
| ' Assumes the first column does NOT have a blank in it | |
| Sheets(sheetName).Select | |
| Range("A1").Select | |
| Selection.End(xlDown).Select | |
| Dim totalRows As Long | |
| totalRows = ActiveCell.Row ' do NOT subtract one for the header | |
| HowManyRows = totalRows | |
| End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment