Forum Discussion
djvas89
Feb 25, 2021Copper Contributor
Fill Dashboard Table based on Criteria "OrderNumber"
Hello, I've look through all the suggestions but couldn't find any suggestion or solution for my problem. I have a Excel Workbook with two sheets and in the first one it contains a table that...
djvas89
Feb 25, 2021Copper Contributor
That Excel is a dummy file. It's what I've been testing on.
If the columns match on either side it is possible to do?
Can you tell \ hint me on how to do it?
Thanks
HansVogelaar
Feb 25, 2021MVP
Make sure that each of the column headers in D1:Q1 on the Dashboard sheet exactly matches a column header in row 1 of the Montblanc sheet.
And the column header in B1 must also match the column on which you want to filter exactly. For example Nº of intern order.
Right-click the sheet tab.
Select 'View Code' from the context menu.
Copy the following code into the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("B2"), Target) Is Nothing Then
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error GoTo ExitHere
Worksheets("Montblanc").UsedRange.AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range("B1:B2"), _
CopyToRange:=Range("D1:Q1")
ExitHere:
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Switch back to Excel.
Save the workbook as a macro-enabled workbook (.xlsm).
Make sure that you allow macros when you open the workbook.