I'm trying to use a cell value (a department and skills from a value list) to switch to the correct department worksheet and apply a filter using the skill variables vS1 - vS4. Using the macro record I can get the correct code for selecting a specific worksheet etc but when I try and replace the name with a variable I fail. The code is as follows:
Set vDept = Range("U18")
Set vS1 = Range("C2")
Set vS2 = Range("D2")
Set vS3 = Range("E2")
Set vS4 = Range("F2")
If vDept = "vDept" Then
Worksheets("vDept").Select
Worksheets vDept.Activate
End If