Results 1 to 4 of 4

How to get count of rows in a named range?

This is a discussion on How to get count of rows in a named range? within the Excel Questions forums, part of the Question Forums category; I would have thought: ThisWorkbook.Names("MyNamedRange").RefersToRange.Rows -OR- ThisWorkbook.Names("MyNamedRange").RefersToRange.Count -OR- ThisWorkbook.Names("MyNamedRange").RefersToRange.Rows.Count All give me 'Invalid use of propert error'. Any help appreciated....

  1. #1
    Board Regular
    Join Date
    Oct 2003
    Posts
    1,322

    Default How to get count of rows in a named range?

    I would have thought:

    ThisWorkbook.Names("MyNamedRange").RefersToRange.Rows

    -OR-

    ThisWorkbook.Names("MyNamedRange").RefersToRange.Count

    -OR-

    ThisWorkbook.Names("MyNamedRange").RefersToRange.Rows.Count

    All give me 'Invalid use of propert error'.

    Any help appreciated.

  2. #2
    Board Regular Weaver's Avatar
    Join Date
    Sep 2008
    Posts
    5,170

    Default Re: How to get count of rows in a named range?

    Range("MyNamedRange").Rows.Count
    If the above suggestion contains vb code and you're not sure about using macros,check the following links (which in no way should be interpreted as being specific to your individual query):

    http://www.mrexcel.com/articles/past...o-into-vbe.php

    You can find help with array formulas here:

    http://www.cpearson.com/excel/arrayformulas.aspx

    If you really want to learn Excel, don't always accept the first solution.

  3. #3
    MrExcel MVP
    Moderator
    Andrew Poulsom's Avatar
    Join Date
    Jul 2002
    Posts
    67,981

    Default Re: How to get count of rows in a named range?

    This worked when I tried it:

    MsgBox ThisWorkbook.Names("MyNamedRange").RefersToRange.Rows.Count

  4. #4
    Board Regular
    Join Date
    Oct 2003
    Posts
    1,322

    Default Re: How to get count of rows in a named range?

    Thanks everyone for your responses.

    .Rows.Count is working for me now.

    Am quessing IDE was in error state because this started working after closing and reopening the file.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com