I have a worksheet that has a macro that list all of the active worksheets.
I would like to modify it to also add a column that would have a check box that would allow me to to hide or unhide a workbook if the box is checked.
Any help would be great
Code:
Sub ListSheetsTab()'downloaded from www.contextures.com
'list all sheets in active workbook
Dim wb As Workbook
Dim ws As Worksheet
Dim wsM As Worksheet
Dim lColorC As Long 'cell color
Dim lColorT As Long 'tab color
Dim lRow As Long
Dim lRowHead As Long
Dim lCol As Long
Dim lCols As Long
Dim lColEnd As Long
Dim lSh As Long
On Error Resume Next
Application.ScreenUpdating = False
Application.EnableEvents = False
Set wb = ActiveWorkbook
Set wsM = Worksheets("Menu")
lRowHead = 4
lCol = 7
lCols = 3
lColEnd = lCol + lCols - 1
lRow = lRowHead + 1
With wsM.Range(wsM.Cells(lRowHead, lCol), _
wsM.Cells(lRowHead, lColEnd))
.EntireColumn.Clear
.Value = Array("ID", "Sheet", "Tab Color")
End With
With wsM
For Each ws In wb.Worksheets
.Range(.Cells(lRow, lCol), _
.Cells(lRow, lColEnd - 1)).Value _
= Array(lRow - lRowHead, ws.Name)
If ws.Tab.ColorIndex = -4142 Then
.Cells(lRow, lColEnd) _
.Interior.ColorIndex _
= ws.Tab.ColorIndex
Else
.Cells(lRow, lColEnd) _
.Interior.Color _
= ws.Tab.Color
End If
'add hyperlink to sheet name
.Hyperlinks.Add _
Anchor:=.Cells(lRow, lCol + 1), _
Address:="", _
SubAddress:="'" & ws.Name & "'!A1", _
ScreenTip:=ws.Name, _
TextToDisplay:=ws.Name
lRow = lRow + 1
Next ws
With .Range(.Cells(lRowHead, lCol), _
.Cells(lRowHead, lColEnd))
.Font.Bold = True
.EntireColumn.AutoFit
End With
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Any help would be great