![]() rows 6, 25, and 28) which separate the key sections of the financial statement. Let’s say we have an income statement as shown below. However, this causes an additional challenge when we try to find the actual number of populated rows in a worksheet with VBA. ![]() We often work in Excel worksheets with “free-style” layouts and our tables were designed with breaks (empty rows) to make them easier to read. Unlike databases tables (such as Access), Excel tables are not always continuous. ![]() (See line 3 of macro “countDataRows2” below) You’ll only have to select any cell within the list before running the macro. We can enhance the macro to have it automatically find the “CurrentRegion” of the table range. However, you may find it inconvenient to have to manually select the entire list before running the macro. MsgBox tmp & " rows of data in the selection" The macro also returns the answer in a message box. To use the macro, we first select the list of data, and run the macro. The macro “countDataRows1” below uses to find the number of rows of data in the current selection. It is easy to find the number of rows in a list like this. The list in continuous with no “broken rows” in between (i.e. ![]() In this example, we have a list of monthly expense data as shown in the picture below.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |