Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 51

Thread: VBA - Count filtered rows in the table

  1. #41
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post
    it should be a proper result

    Count
    Total rows: 100
    Name filter: 86 Left / Filtered 14
    Region filter: 82 Left / Filtered 4
    Country filter: 79 Left / Filtered 3
    I don't think so, still does not look right
    Quote Originally Posted by DocAElstein View Post

    My results:
    Code:
     "name filter rr ll : 80 Left / Filtered 20
    Region filter sh : 78 Left / Filtered 2
    Country filter us : 75 Left / Filtered 3
    
    "
    or you are not telling me something

    I am going jogging in the Sun
    Last edited by DocAElstein; 08-29-2023 at 02:19 PM.

  2. #42
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    remember to take a pictures
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  3. #43
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    I need to rewire my brain
    Last edited by sandy666; 08-24-2023 at 09:14 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  4. #44
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post
    remember to take a pictures
    I can't take my camera, because I jog fast and very hard, so I might break it. Here is pic from about 18 months ago after I first discovered my old train line. So then I stole some wood and pallets and made a nice secret place to sit.

    I go there sometimes and drink Bier. Not often because always drinking beer is unhealthy. But when I do go I drink lots. I only did it 2 times this summer. Maybe in a few days before Summer end I will go again. Then I go with bike and trailer full with beer. Then I can take a new picture..




    Quote Originally Posted by sandy666 View Post
    I need to recalculate all....I need to rewire my brain
    Just a suggestion, to make it easier for us both
    Maybe make new text file, maybe just 30 lines.
    Use just English characters
    Choose data that test all filters

    Then we can first, - forget VBA, forget PQ , and first do it manually so we are sure what results should be.

    Then after try PQ and VBA

    Just a suggestion, that’s all.
    Last edited by DocAElstein; 08-24-2023 at 10:08 PM.

  5. #45
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    here is table from csv (100 rows)
    with CF defined for each filter (hardcoded) then table filtered by No Color
    The trick is that the filter should not be hardcoded
    with rows counted manually
    Attached Files Attached Files
    Last edited by sandy666; 08-25-2023 at 05:05 AM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  6. #46
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post
    here is table from csv (100 rows)
    with CF defined for each filter (hardcoded) then table filtered by No Color
    I don’t know anything about CF or Filters in Excel, so I don’t know what to do with any of that.
    Never mind




    That table looks the same as the Tables and the csv text files we have used so far.


    In that last file I added another worksheet, ManuellAlan copied the data range, and then did it all manually
    , no VBA
    , no PQ
    , no CF, filter or anything
    , just Alan and his hands very big brain.

    Results from me doing it with just my brain and hands:

    _____ Workbook: test01.xlsx ( Using Excel 2010 32 bit )
    Row\Col
    AI
    2
    Filter name by ll and rr takes out 20 rows, so left with 80
    3
    Then filter region by sh takes out 2 rows, so 78 left
    4
    Then filter country by us takes out 3 rows, so I am left wir 75
    Worksheet: ManuellAlan



    Results from my VBA coding
    For this filter set:

    , I still get the same results as before:


    , and they are the same as when I did it all manually.



    So, so far I think my VBA coding is giving the correct results.
    Attached Files Attached Files
    Last edited by DocAElstein; 08-25-2023 at 12:01 PM.

  7. #47
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    CF - conditional formatting
    Filter - filter each column by NoColor starting from far left
    you just retyped in many words all what I show with one table
    what is your office version?
    could you write single, one step, code vba?

    not like this where it is not clear what to do
    mvba.png
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  8. #48
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post
    what is your office version?
    At the moment I am mostly using Excel 2010.
    (I also have and use 2003 2007 2010 2013)





    Quote Originally Posted by sandy666 View Post
    you just retyped in many words all what I show with one table
    Correct. I did it all manually, just to check again if my results were correct. That is all.
    I did not know what to do with what you gave me ….
    What was I supposed to do? ….I know you know, but …..






    Quote Originally Posted by sandy666 View Post
    ...could you write single, one step, code vba?...not like this where it is not clear what to do
    mvba.png.

    The macro I wrote for you will not be shown in that list you showed,
    So far, most of the macros I wrote for you should work automatically, ( this is what I tried to explain here: https://www.excelfox.com/forum/showt...ll=1#post23239 )

    The macros should work automatically. They start when you do something in the first worksheet, Filters

    You cannot run them when you want to. It is not difficult to arrange that. But it is not what you originally asked for. You know what you want, but...


    It is difficult to explain everything if you have little experience running macros, just as if you try to explain me to do something in PQ, ….

    I try again.
    I modified slightly my last file.
    So now it is uploaded here, called FilTit3c.xlsm


    Try to do this:

    _1) download FilTit3c.xlsm
    ( download it anywhere. Forget the csv file for now. I already put it in for this attempt, just to see if you can get the fucking VBA thing to work )
    ( For now I put table already in : )


    _2) open FilTit3c.xlsm ( I tried to explain here https://www.excelfox.com/forum/showt...ll=1#post23223 how to make macros enabled )


    _3) go to first worksheet, Filters




    _4) type us in cell E2,

    (and press Enter)





    If it works you will first see my Hairy Goolies in worksheet ResultsAlan. But you will only see my Hairy Goolies for 2 seconds.




    Then you will see more simplified results like what you want






    If that does not work, then we should probably best first forget everything, and start with a new file and try to get any simple macro working for you.
    Otherwise it is like you are trying to fly to the moon before you have learnt to walk….
    Attached Files Attached Files
    Last edited by DocAElstein; 08-30-2023 at 01:29 PM.

  9. #49
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    It's too complicated, too much green color in your code - I understand nothing!
    I have decided not to use vba ever again
    thanks for trying , thanks for your time
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  10. #50
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post

    thanks for trying , thanks for your time
    Sure no problem.




    Quote Originally Posted by sandy666 View Post
    It's too complicated, too much green color in your code - I understand nothing!
    I have decided not to use vba ever again…
    That is a bit like me with PQ I suppose. I would like to understand it, but I doubt I will ever get the time.

    Also I think with VBA it makes a very big difference if your native language is English or not. It is very wordy , but only in English. Half the code speaks for itself. It’s very visual in a basic sort of way….
    I expect that if VBA was in other languages and not just English, then the main VBA forums would not have half the traffic they do. Anyone whose native language is English should be able to pick up VBA quite quickly

    As for the ' green comments, there is a couple of things you can do to get rid of them.
    Hide comments,
    _ For one thing, there is loads of room to the right, so you can………………… ----->
    Code:
                                                                     
                                                                                     ---->                                                          ……………………………………………………………………………………………………………………………………….. put comments way way out to the right so you don’t have to see them all the time. It’s great for hiding links to good references and hiding links to good porno sites
    It looks like there are about 1023 characters https://www.excelfox.com/forum/showt...ll=1#post10948 So you have plenty of space to put lots of stuff in

    Remove comments
    _ The other thing you can do to get rid of them is a search and replace with wild cards,

    Before:

    Highlight the code you want to clean up and find the Search thing
    , , or , or use keys Ctrl+F ( when in VB Editor )


    You need to da a search with wild card with these two characters, ( no space in between) '*


    Then you leave the replace bar empty and do a replace all

    '* <------ Find
    <--- Replace ( leave empty )


    Then they are gone.


    ( Only very rarely that can give a problem because sometimes a ' is used in coding. So you might accidently lose a bit of coding. But that does not happen often. I don’t think I have any ' inside the coding I did for you. )

    I would be surprised if removing comments makes a coding easier to understand. Many people just don't like having them there, often people who already know VBA and/ or the particular coding very well. But they are easy to get rid of if you don't like to see them. Just personal preference, but they are easier to get rid of

    VBA cannot currently read your mind and write a code for you. But probably ChatGPT & co. will come close to doing all that, or one way or another it will get rid of most of us. Newer versions of Windows, Office, and most Microsoft will all become just something like Chat GPT and artificial intelligence. We have no long term future, other than to become self sufficient with earlier versions and have nothing to do with Microsoft and any of their software from the last 10 - 15 years

    Currently you would also need yourself to download a file and open it and use it, unless you can get someone else to do that for you. I can't do that over the internet, I figured you could / would do that at least. But hey, why be dull and conventional! Do / don't do wot you want, seriously – there is too many people in forums acting like teachers in a nursery school from the 1950’s. They’re too weak or stupid to cope with real hard life I expect.



    Quote Originally Posted by sandy666 View Post
    I have decided not to use vba ever again..
    You should never say never to anything, JIMO … or…well perhaps there is… maybe say never to anal sex. I would never do that, not even if I was Gay. Poking my cock into shit is the worst thing I can think of, ( apart from maybe trying to Learn PQ, that might be almost as bad. Although if I had to choose between poking my cock into shit, or learning PQ, I probably would choose learning PQ. But it would be a close thing! I speak English but I can’t make head or tail of PQ code. I don’t even know how/ where to find the code. I never got a PQ to work even on my Excel 2013 ( https://www.excelfox.com/forum/showt...ll=1#post23219
    ( https://www.excelfox.com/forum/showt...3214#post23214 )
    ) )

    You don’t have to understand all of a VBA coding to use it, - most peole using a VBA macro don't understand it.
    But I agree it’s best not to use coding you don’t understand. But that is just personalö preferrance. I personally only ever started learning because I needed it for some important personal projects, and I don’t like using things that I don’t understand.





    I started doing some further notes earlier today, https://www.excelfox.com/forum/showt...ll=1#post23247
    You probably aren’t interested, but I will probably finish them anyway, maybe in a day or two. sometime for my own reference. There is some amazing stuff in those codes that only I know about because I discovered them. It still is a long complicated coding, but without the amazing stuff I discovered , it would be even more complicated and probably 3- 4 time longer.
    I don’t know all VBA. No one can know it all, it is just too big. You could not learn it all even if you did nothing else for your whole life. I only know a very small part of it. But some of what I know I know better than anyone. I got a big cock as well. (But I don’t stick it in peoples arse). If my YouTube / VBA / forum career does not take off, I can earn lots of money as a Gigolo instead.
    Last edited by DocAElstein; 08-26-2023 at 11:05 AM.

Similar Threads

  1. Replies: 101
    Last Post: 06-11-2020, 02:01 PM
  2. Delete Filtered Rows Excluding The Header
    By xander1981 in forum Excel Help
    Replies: 5
    Last Post: 04-01-2014, 11:44 PM
  3. Replies: 1
    Last Post: 07-30-2013, 11:08 PM
  4. Lookup and Count Using Pivot Table
    By RobExcel in forum Excel Help
    Replies: 2
    Last Post: 12-21-2012, 11:08 AM
  5. Unique Count on a Filtered Range
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-14-2011, 04:29 AM

Posting Permissions

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