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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,214,829
Messages
6,121,827
Members
449,051
Latest member
excelquestion515

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