+ Reply to Thread
Results 1 to 5 of 5

VBA to count cells with data between blank rows

  1. #1
    Registered User
    Join Date
    06-19-2012
    Location
    London
    MS-Off Ver
    Office 2011 Mac
    Posts
    2

    VBA to count cells with data between blank rows

    Hi

    I have a VBA that will count the data in column between blank rows. The problem i have is that the results are always placed at the bottom of each group. Which means when i use the remove duplicates tool i lose the data in in column B in the example below.

    Data to grouped VBA Results
    to be counted

    abc
    abc
    abc 3

    DEF 1

    GHI
    GHI 2

    This is the VBA i am using


    Please Login or Register  to view this content.
    I either need to have the results at the top of each group or for the results to be put on every row.

    Any ideas?
    Last edited by Leith Ross; 06-20-2012 at 01:32 AM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA to count cells with data between blank rows

    Hello Philcater,

    Welcome to the Forum!

    This will place the count to right of the first element in the group.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: VBA to count cells with data between blank rows

    You can do this with a formula
    In B1
    Please Login or Register  to view this content.
    Drag/Fill Down

    If you must have VBa then this translates as ...
    Please Login or Register  to view this content.
    This might be faster than looping on larger ranges.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Registered User
    Join Date
    06-19-2012
    Location
    London
    MS-Off Ver
    Office 2011 Mac
    Posts
    2

    Re: VBA to count cells with data between blank rows

    Hi Thanks for the welcome. Leith Ross your code works perfectly and was just what i needed!

    Thank you both for your help its going to save me so much time!

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA to count cells with data between blank rows

    Hello Philcater,

    You're welcome. Glad I could help out.

+ 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