Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook with two worksheets, each one with a table and I'm trying
to get a macro to run that filters the the second worksheet table with the value of the the cell selected in column A of the first worksheet. After getting some hints here on this forum I came up with: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Windows("Inventory Items.xlsm:1").Activate If ActiveCell.Column = 1 Then Dim ItemNum As String ItemNum = "=" & ActiveCell.Text Windows("Inventory Items.xlsm:2").Activate ActiveSheet.ListObjects("Table_Default__ipurch").R ange.AutoFilter Field:=1, _ Criteria1:=ItemNum, Operator:=xlAnd Windows("Inventory Items.xlsm:2").Activate End If End Sub but it doesn't work automatically when I select another cell (in the first column)even though it runs perfectly when I run it manually with the first line changed to: Sub FilterPurchases() How does one get it to run automatically when the selection changes? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you move the selection one cell to the right in a macro | Excel Programming | |||
Macro - Dynamic cell selection | Excel Discussion (Misc queries) | |||
Macro help on Cell Selection | Excel Programming | |||
Cell selection in a macro | Excel Programming | |||
Cell selection in a macro | Excel Programming |