I have a workbook with multiple sheets.
Every sheet with data has a common column, K, which contains Client Manager names. In Sheet2 I have used a Data Validation field in C1 using a list, so creating a drop down where I can select a Client Manager. So if I select Charlie Brown, and run a macro, I would like all sheets to be filtered to only show Charlie Brown’s data.
I am an absolute VBA beginner, so I have harassed Mr Google mercilessly – the majority of suggestions involve hard-coding the filter value, rather than making it a variable cell value. The best I have found is this:
Sub apply_autofilter_across_worksheets()
Dim xWs As Worksheet
On Error Resume Next
For Each xWs In Worksheets
xWs.Range("K").AutoFilter 1, CLng(Sheets("Sheet2").Range("C1").Value)
Next
End Sub
When I run the macro:
• Positive - no error!
• Negative - nothing happens
I'm not sure what this does: xWs.Range("K") - the original script had a number after the column letter, but no matter what number I put after it, it makes no difference.
I also simply typed a Client Manager name into C1, with no impact. So clearly it's just all busted. There are 8 data worksheets, plus Sheet2. The number of columns vary sheet to sheet, but none are more than AZ.
Any help would be greatly appreciated please!