+ Reply to Thread
Results 1 to 8 of 8

Count the number of rows in active cell's current column using VBA.

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    27

    Count the number of rows in active cell's current column using VBA.

    Hi

    How do I count the number of rows (that are not blank) in my activecell's current column?

    I have this so far:

    Please Login or Register  to view this content.
    I then need to take that value and put it here:


    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Count the number of rows in active cell's current column using VBA.

    Hi,

    try it with the CountA function:
    Please Login or Register  to view this content.
    Regards
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Count the number of rows in active cell's current column using VBA.

    Quote Originally Posted by tehneXus View Post
    Hi,

    try it with the CountA function:
    Please Login or Register  to view this content.
    Regards
    Sorry, that doesn't work.

    A more detailed explanation of what I require:
    Column A
    Header
    Value
    Value
    Value
    Value
    (blank)
    (blank)
    ...
    (blank)


    The (blank) rows contain formula's whose output returns an empty cell.
    I need the total number of rows that have stuff in them that exclude the header row.
    So in this case, total rows = 4.

  4. #4
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Count the number of rows in active cell's current column using VBA.

    OK, if you have formulas not be counted use this:
    Please Login or Register  to view this content.
    and please do not quote entire post

    Regards

  5. #5
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Count the number of rows in active cell's current column using VBA.

    Please Login or Register  to view this content.
    Hmm, I tried that but I get a run-time error 1004.

  6. #6
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Count the number of rows in active cell's current column using VBA.

    Please note that this line contains the variable "LastRow" which you mentioned you have already. Also this works only if you are sure to have at least 1 value in current column, if you are not sure you'll have to create a range object and check it:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Count the number of rows in active cell's current column using VBA.

    Quote Originally Posted by tehneXus View Post
    Please Login or Register  to view this content.
    Oh ok that makes more sense.
    However, I think you somewhat misinterpreted me:

    My "Values" are values that are derived from formula's in that cell. I mean that every row in each column has formulas in them but some of them return data and others return blank. I want the total number of rows that contain valid results.

  8. #8
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Count the number of rows in active cell's current column using VBA.

    If anyone is still interested, I figured it out:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1