filtering

  • I'm using auto-filter in my applications in order to filter my data(a name for example).my problem is that i can't figure out a way to create a macro that will help me "pick" the name and copy it to another cell.i'm interested in copying just the criteria and not the whole selection.

  • Need a better explanation. Do you want an inputbox so a user can enter a name and the database will filter on that name and copy some stuff to another worksheet?

  • If you want to detect which columns contain a filter and the criteria for the filter, then you can apply the following code (it assumes you have a database with a filter and some criteria in the worksheet 'Sheet1':




    Hans

  • I don't know how to trigger an event by just changing the filter criterion. In case you change something on your sheet or in case you select another cell, you can use the workbook sheetchange and workbook sheetselectionchange events to put the "criterion" in the cell you want. Like this: In the ThisWorkbook module, put the following code:



    Code
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
       Call UpdateCell15
    End Sub
    
    
    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
       Call UpdateCell15
    End Sub


    Then add a general module to the VBAproject and add the following code




    It would be better if cell(1, 5) was automatically filled with the name in your selection, but I can't figure out how this can be done.


    Hans

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!