count total number of rows of data in excel

  • 14 years ago

    I need to write a macro that will tell me the total number of rows of data, through a variable name, that are on the worksheet.  Anybody?

     

  • 14 years ago

    Hi,

    I understand that you want to count the number of records in an excel sheet. If so use the following code assuming that the first record is in the cell A1:

        Dim Count As Integer
        Range("a1").Select
       
            Range(Selection, Selection.End(xlDown)).Select
       
        Count = Selection.Cells.Count
       
        Range("a1").Select








    Hope this works for you.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous