+ Reply to Thread
Results 1 to 25 of 25

Macro for filters

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Macro for filters

    Hi,
    the attached macro serves to filter values that are shown in column C.
    How it works:
    entering a value in the yellow cell E2: I2 if there is
    in column C and then clicking the button "FIND A" are filtered.
    To return to the normal view click on "REMOVE FILTER".
    I ask for help for a new macro.
    The new macro must work for columns D / E / F / G / H / I / J / K / L / M.
    Writing a value in cell E2: I2 if it is present in a cell of the columns
    D / E / F / G / H / I / J / K / L / M must filter them all together.
    I hope I explained.
    A greeting.
    ------------------------------------------------------------------------------
    Salve,
    la macro allegata serve per filtrare valori che sono presenti nella colonna C.
    Funziona così:
    inserendo un valore nella cella gialla E2:I2 se è prensente
    nella colonna C e poi cliccando nel pulsante "TROVA A" vengono filtrati.
    Per tornare nella visualizzazione normale cliccare in "TOGLI FILTRO".
    Chiedo un aiuto per una nuova macro.
    La nuova macro deve funzionare per le colonne D/E/F/G/H/I/J/K/L/M.
    Scrivendo un valore nella cella E2:I2 se è presente in una cella delle colonne
    D/E/F/G/H/I/J/K/L/M li deve filtrare tutti assieme.
    Spero di essermi spiegato.
    Un saluto.

    max_max.xls

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro for filters

    Here's the first problem
    You have,
    Please Login or Register  to view this content.
    You only have one column selected, the field is just 1

    You have set y as a range variable, so "why" not use it.

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro for filters

    What if they are all in different rows?
    They can be filtered, but just the last one will be showing.
    Last edited by davesexcel; 12-21-2014 at 07:00 AM.

  4. #4
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Hello davesexcel.
    With the new changes the macro 1 ( Sub ApplicaFiltro1 ) works.
    The new macro must work in the range D6:M50.
    max_max
    -----------------------------------------------------------------------
    Ciao davesexcel.
    Con la nuova modifica la macro 1 ( Sub ApplicaFiltro1 ) funziona.
    La nuova macro deve funzionare nel range D6:M50.
    max_max

  5. #5
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    This formula for conditional formatting.

    =COUNTIF(D6,"*"&$E$2&"*")
    =CONTA.SE(D6;"*"&$E$2&"*")

    to highlight the repeated values.
    I try the same function with automatic filters, the same work that makes the macro 1
    max_max
    ----------------------------------------------------------------------------------------
    Questa formula per formattazione condizionale.

    =COUNTIF(D6,"*"&$E$2&"*")
    =CONTA.SE(D6;"*"&$E$2&"*")

    per evidenziare i valori ripetuti.
    Io cerco la stessa funzione con i filtri automatici, lo stesso lavoro che fa la macro 1
    max_max

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro for filters

    Check this out, this will highlight the cells that equal E2.
    Please Login or Register  to view this content.
    Please attach a sample that shows your desired result.

    Allegare un campione che mostra risultato desiderato .

  7. #7
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Hello davesexcel,
    I enclose the result of the new macro.
    That's not how I try the result.
    You can change the macro ApplicaFiltro1 because functions for range D6: M50?
    max_max
    ------------------------------------------------------------------------------
    Ciao davesexcel,
    allego il risultato della nuova macro.
    Non è così che cerco il risultato.
    E' possibile modificare la macro applicafiltro perchè funzioni per il range D6:M50?
    max_max

    Attachment 366090

  8. #8
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Il risultato
    Appunti01.jpg
    max_max

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro for filters

    There is no attachment

  10. #10
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Hello the result of your macro attached.
    What I try is changing the macro <applicafiltro1> for range D6: M50 columns D/E/F/G/H/I/J/K/L/M.
    I hope I explained.
    max_max
    ---------------------------------------------------------------------------------------------------------------------
    Ciao il risultato della tua macro allegata.
    Quello che cerco è la modifica della macro <applicafiltro1> per il range D6:M50 colonne D/E/F/G/H/I/J/K/L/M.
    Spero di essermi spiegato.
    max_max

    max_max.xls

  11. #11
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro for filters

    I don't understand your explaination. I already gave you a code the will highlite the cells that is entered in E2

  12. #12
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Hello davesexcel,
    unfortunately not knowing the English translation I make with google translator.

    The macro "applicafiltro1" filters the data in column C that are placed in the cell E2.
    I try a macro for columns D/E/F/G/H/I/J/K/L/M together.
    A change in the macro "applicafiltro1" for these columns is possible?
    I hope I explained.
    max_max

    ------------------------------------------------------------------------------------------

    Ciao davesexcel,
    putroppo non conoscendo l'inglese la traduzione la faccio con google traduttore.

    La macro "applicafiltro1" filtra i dati della colonna C che vengono inseriti nella cella E2 .
    io cerco una macro per le colonne D/E/F/G/H/I/J/K/L/M assieme.
    Una modifica della macro "applicafiltro1" per queste colonne è possibile?
    Spero di essermi spiegato.
    max_max

  13. #13
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    The change should be so:
    La modifica dovrebbe essere così:

    Please Login or Register  to view this content.
    but I think the mistake here, multiple filters do not work.
    ma penso l'errore sia qui, i filtri multipli non funzionano.


    y.AutoFilter Field:=4, Criteria1:=c
    y.AutoFilter Field:=5, Criteria1:=c
    y.AutoFilter Field:=6, Criteria1:=c
    y.AutoFilter Field:=7, Criteria1:=c
    y.AutoFilter Field:=8, Criteria1:=c
    y.AutoFilter Field:=9, Criteria1:=c
    y.AutoFilter Field:=10, Criteria1:=c
    y.AutoFilter Field:=11, Criteria1:=c
    y.AutoFilter Field:=12, Criteria1:=c


    max_max

  14. #14
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro for filters

    Yep, that's what I told you in Post #3

  15. #15
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Then the macro can not be changed?
    max_max
    ---------------------------------------
    Quindi la macro non si può modificare?
    max_max

  16. #16
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    If you can not filter out multiple columns you can filter rows
    where the cells there is a certain value?
    max_max
    ------------------------------------------------------------------------
    Se non si può filtrare le colonne multiple è possibile filtrare righe
    in cui nelle celle sia presente un determinato valore?
    max_max

  17. #17
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Hi,
    probably the change that you can not ask.
    I thought of this:
    filter rows where the cells where there is a certain color given by the formula:
    =CONTA.SE(D6;"*"&$E$2&"*")
    =COUNTIF(D6,"*"&$E$2&"*")
    which is inserted in the conditional formatting range D6: M50?
    I am attaching an example.
    max_max

    -----------------------------------------------------------------------------------------

    Salve,
    probabilmente la modifica che chiedo non è possibile.
    Ho pensato a questo:
    filtrare righe in cui cui nelle celle c'è un determinato colore dato dalla formula:
    =CONTA.SE(D6;"*"&$E$2&"*")
    =COUNTIF(D6,"*"&$E$2&"*")
    che è inserita nella formattazione condizionale del range D6:M50?
    allego un esempio.
    max_max

    max_2.xls

  18. #18
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Macro for filters

    Hi,

    Maybe this is what you expected :

    Please Login or Register  to view this content.
    Regards
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  19. #19
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Thanks karedog,
    should be exact.
    it is possible that in your macro line filter 5 remains visible?
    max_max
    ------------------------------------------------------------------------
    Grazie karedog,
    dovrebbe essere esatto.
    è possibile che nella tua macro la riga dei filtri 5 resti visibile?
    max_max

    max_caredog.xls

  20. #20
    Registered User
    Join Date
    07-26-2013
    Location
    Near DC, USA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Macro for filters

    I work with VBA professionally on a daily basis but I struggle to understand still what this post is trying to accomplish. Are you trying to:

    1) Filter to view only certain columns so that only certain columns show up based upon certain values?

    OR

    2) Filter the normal way to view only certain rows, but based upon values in multiple columns?

    If you are trying to do #1 one solution is to transpose the worksheet and then use advanced filtering or a helper column to combine the columns and do a search for the string you are searching for.

    If you are trying to do #2, have you tried using Excel's advanced filtering feature which is designed for filtering to view rows based upon values in multiple columns? That does not require VBA and may get your desired results much easier. Just an idea. Hope your google translator works well enough from English to your language, but from your language to English I am still completely confused what is trying to be accomplished after reading all the threads.

    Sometimes a non-VBA solution is better, quicker, etc.. Making a helper column with an equation that combines all the columns is another way to avoid the need of VBA or the advanced filter option.

  21. #21
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Macro for filters

    Quote Originally Posted by max_max View Post
    Thanks karedog,
    should be exact.
    it is possible that in your macro line filter 5 remains visible?
    max_max
    You are welcome.
    First, unhide row 5 manually, then change the code of this line :

    Please Login or Register  to view this content.
    Regards

  22. #22
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Thanks karedog
    that's perfect!
    Greetings from Italy.
    max_max
    ----------------------------------------
    messagge for richard:
    I tried to filter with advanced filter but I could not solve, so I asked for help with VBA.
    max_max

    ===============================================================================================

    Grazie karedog
    è perfetto!
    Un saluto dall'Italia.
    max_max
    ----------------------------------------
    Messagggio per richard
    Ho provato a filtrare con filtro avanzato ma non sono riuscito a risolvere, per questo ho chiesto un aiuto con il VBA.
    max_max

  23. #23
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Macro for filters

    You are welcome max_max, thanks, greetings from Indonesia.

    Italy, the home of pizza and cappuccino, very delicious food. You must be enjoying them very much.

    Regards

  24. #24
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: Macro for filters

    Thanks again karedog,
    you know pasta and tiramisu (cake delicious Italian)?
    http://en.wikipedia.org/wiki/Tiramisu
    max_max
    ------------------------------------------------------------
    Grazie ancora karedog,
    conosci pasta e tiramisù?
    http://en.wikipedia.org/wiki/Tiramisu
    max_max

  25. #25
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Macro for filters

    Absolutely, very delicious cakes, they are very well known here in Indonesia too.

    Well, see you in another thread, it's nice to meet you.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 7
    Last Post: 07-15-2019, 03:06 AM
  2. Macro & filters
    By Toxicca in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-06-2014, 10:19 AM
  3. Using filters, and then unselecting filters. Organizing data.
    By lesoies in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-09-2013, 07:55 AM
  4. Replies: 4
    Last Post: 07-24-2012, 01:21 PM
  5. Macro with Filters
    By Alwaysmiling in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-22-2011, 06:43 PM

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