Consulting

Results 1 to 3 of 3

Thread: Counting Used Rows In Column - Best Method?

  1. #1
    VBAX Tutor MINCUS1308's Avatar
    Joined
    Jun 2014
    Location
    UNDER MY DESK
    Posts
    231

    Counting Used Rows In Column - Best Method?

    Is there a way to count the used rows in a specified column?
    Preferably without using the end(xlUp) or end(xlDown) method.

    I was hoping for something like:
    MsgBox ActiveSheet.UsedRange.Columns.Count
    MsgBox ActiveSheet.UsedRange.Rows.Count
    - I HAVE NO IDEA WHAT I'M DOING

  2. #2
    Knowledge Base Approver VBAX Guru
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    4,025
    Depends what you're after; you can count the non-empty cells in a column with a worksheet function:
    =COUNTA(F:F)
    or in vba:
    msgbox application.counta(activesheet.columns("F"))

    If you're wanting to find the first and last used cells there will be other ways, perhaps including range.find, or SpecialCells.
    Come back if that's the case.
    p45cal - - - - -This is my signature, it appears after all my posts. Below is not directed at anyone in particular - so don't take offence! - (You might guess why it's there though)
    If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Tutor MINCUS1308's Avatar
    Joined
    Jun 2014
    Location
    UNDER MY DESK
    Posts
    231
    Thank you p45al,
    application.counta(activesheet.columns("F")) will get the job done.
    The simplest solution is often the hardest to see.
    - I HAVE NO IDEA WHAT I'M DOING

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •