Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

Using a variable to call up a different worksheet [closed]

$
0
0

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

Viewing all articles
Browse latest Browse all 88835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>