+ Reply to Thread
Results 1 to 6 of 6

changing a current mod (count unique visible cells ->count unique visible cells criteria

  1. #1
    Registered User
    Join Date
    04-29-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    17

    changing a current mod (count unique visible cells ->count unique visible cells criteria

    Hi,

    I need help changing a current module I've found online, this module counts unique visible cells in a range, and I would like to change it to count unique visible cells in a range according to an criteria, the thing is the criteria is a different range (1 column to the left of rng in the function).

    Original Code

    Please Login or Register  to view this content.
    Want to change it to:
    Please Login or Register  to view this content.
    Can I iterate on more than 1 range in the same loop? like rng1.Next and rng2.Next in the same loop?
    Cause I tried to add a 2nd range to the function and tried to make it iterate on both ranges as but it didn't work.

    Just to make things clear this a #c code to explain what I want to do


    Please Login or Register  to view this content.
    I know c\c++ & java but never tried VB which seems like a mess, I've tried to describe my problem the best I could, I hope its understandable.

    Any help will be appreciated.
    Last edited by liranbo; 04-29-2012 at 04:29 PM.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: changing a current mod (count unique visible cells ->count unique visible cells criter

    I don't know C\C++ or java, but try using this line...
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-29-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: changing a current mod (count unique visible cells ->count unique visible cells criter

    Quote Originally Posted by dangelor View Post
    I don't know C\C++ or java, but try using this line...
    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.
    Thx for the fast response! I just gave it a quick check and it seems to be working!

    I didn't knew that offset method - it sure helped a lot.


    Many thanks!

  4. #4
    Registered User
    Join Date
    04-29-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: changing a current mod (count unique visible cells ->count unique visible cells criter

    One more thing plz it will also count cells in the range which are Empty.

    Is there a way to set another rule to :

    If Not rCell.Rows.Hidden And rCell.Offset(0, -1).Value = i And Not rCell.isEmpty Then

    is there something like that?

  5. #5
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: changing a current mod (count unique visible cells ->count unique visible cells criter

    syntax is the other way around... IsEmpty(rCell)

  6. #6
    Registered User
    Join Date
    04-29-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: changing a current mod (count unique visible cells ->count unique visible cells criter

    Thanks again!

+ 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