List Worksheets that have a specific value in a cell

John Sadler

New Member
Joined
May 1, 2012
Messages
48
Hi folks .. I have a macro that lists (as hyperlinks) the Names of an array of Worksheets. Problem for me is this is not dynamic. The Worksheets relate to staff and when they leave I have to change the Array. In each Worksheet I have cell U1 that tells me if the Staff Member is Active or Inactive.

So, I would like to list the names of only the sheets where U1 = Active

This way I have a more dynamic macro that I don't have to change.

Hope someone can help me out please

Cheers John
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
John

Can you post your current code?
 
Upvote 0
John

Can you post your current code?

Here you go:

Sub ListSalesRepSheets()

Application.ScreenUpdating = False
Dim ws As Worksheet
Dim cell As Range

'Sheets("Welcome").Select
'Range("B6").Select
'Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("B6").Select


For Each ws In Worksheets(Array("Annette Short", "Aaron Fidge", "Anthony Tavuileota", "Ash Gopalraj", "Bryce Scholes", "Jas Dhillon", "Dennis Eyck", "Gavin Churton", "Jim Walsh", "Patrick Matthews", "Richard White", "Domenic Crouch", "Siobhan Spratt"))


If ws.Visible = xlSheetVisible And ActiveSheet.Name <> ws.Name Then

ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'" & ws.Name & "'" & "!B6", TextToDisplay:=ws.Name
ActiveCell.Offset(1, 0).Select

End If

Next ws
Range("B4").Select
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top