0

We use a formula to filter the data in a spreadsheet based on one cell. The filter runs when you press "enter". We want the filter to run every time we add a character to the cell.

For example if we type "frans" in a2 and press enter it will filter on "frans" but we want it to already filter on the first character "f" if we type it.

Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice 20160606
   If Target.Address = Range("a2").Address Then
       Range("A5:E2500").CurrentRegion.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("a1:a2")
   End If
End Sub
Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
Info Info
  • 11
  • 4
  • 1
    Looks like a duplicate of: https://stackoverflow.com/questions/11153995/is-there-any-event-that-fires-when-keys-are-pressed-when-editing-a-cell - the summary of which is that native Excel has no event for keypress, but you can capture it via an API call. Not tested. – Jon Jul 02 '19 at 08:04
  • As snazzy as this sounds, it could slowdown user interaction. Might not be an issue with what you are trying to achieve but worth keeping in mind – Zac Jul 02 '19 at 10:28

0 Answers0