# List Visible Sheet Names (with Hyperlinks if possible?)

#### voyto

##### New Member
Hi All,

I currently use workbook to manage my purchase orders at work. It's made up of a "Start" sheet, the "Template" and followed by all my orders. When orders are invoiced, I hide the sheet.

My start sheet is just a button (that duplicates the template, numbers the sheet, etc)

The template is self explanatory

What I'm trying to do is make a list on my start sheet showing all the visible sheets (minus sheets 1 and 2 (start and template) - essentially my "current open orders".
In the adjacent cell to each number, I'd also like the customer name, which can be easily taken from cell A9 within each order sheet
Also, if it's do-able, each number to be a hyperlink to that specific sheet

I'm assuming this would be done on sheet start-up, so possibly needs clearing before listing again?

This would make it really easy for me to see all the current orders when the sheet is loaded ### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

#### Fluff

##### MrExcel MVP, Moderator
VBA Code:
``````Private Sub Workbook_Open()
Dim i As Long, j As Long

j = 2
With Sheets("Start")
.Range("A2:B" & .Range("A" & Rows.Count).End(xlUp).Row).ClearContents
For i = 3 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
With .Range("A" & j)
.Value = Sheets(i).Name
.Offset(, 1).Value = Sheets(i).Range("A9").Value
j = j + 1
End With
End If
Next i
End With
End Sub``````
This needs to go in the ThisWorkbook module & will run when you open the workbook.

• voyto

#### voyto

##### New Member
That worked perfectly, thank you so much!

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

#### voyto

##### New Member

VBA Code:
``````Private Sub Workbook_Open()
Dim i As Long, j As Long

j = 2
With Sheets("Start")
.Range("A2:B" & .Range("A" & Rows.Count).End(xlUp).Row).ClearContents
For i = 3 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
With .Range("A" & j)
.Value = Sheets(i).Name
.Offset(, 1).Value = Sheets(i).Range("A9").Value
j = j + 1
End With
End If
Next i
End With
End Sub``````
This needs to go in the ThisWorkbook module & will run when you open the workbook.

Sorry for being a pain - I've tried to adjust but I clearly just don't understand properly. Would you mind tweaking slightly?

- results to be sheetName, H20, A9 from the order sheet, not just sheetName and A9
- results to start from the 8th row. They are currently starting on the second row

#### Fluff

##### MrExcel MVP, Moderator
VBA Code:
``````Private Sub Workbook_Open()
Dim i As Long, j As Long

j = 8
With Sheets("Start")
.Range("A2:B" & .Range("A" & Rows.Count).End(xlUp).Row).ClearContents
For i = 3 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
With .Range("A" & j)
.Value = Sheets(i).Name
.Offset(, 1).Value = Sheets(i).Range("H20").Value
.Offset(, 2).Value = Sheets(i).Range("A9").Value
j = j + 1
End With
End If
Next i
End With
End Sub``````

#### voyto

##### New Member

VBA Code:
``````Private Sub Workbook_Open()
Dim i As Long, j As Long

j = 8
With Sheets("Start")
.Range("A2:B" & .Range("A" & Rows.Count).End(xlUp).Row).ClearContents
For i = 3 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
With .Range("A" & j)
.Value = Sheets(i).Name
.Offset(, 1).Value = Sheets(i).Range("H20").Value
.Offset(, 2).Value = Sheets(i).Range("A9").Value
j = j + 1
End With
End If
Next i
End With
End Sub``````

That also worked great, thanks.

Promise this will be the last adjustment now (if you don't mind of course).

Can you limit the "clear contents" to only the first 100 rows? I have data below that's getting wiped out

#### Fluff

##### MrExcel MVP, Moderator
Try
VBA Code:
``````Private Sub Workbook_Open()
Dim i As Long, j As Long

j = 8
With Sheets("Start")
.Range("A8:C100").ClearContents
For i = 3 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
With .Range("A" & j)
.Value = Sheets(i).Name
.Offset(, 1).Value = Sheets(i).Range("H20").Value
.Offset(, 2).Value = Sheets(i).Range("A9").Value
j = j + 1
End With
End If
Next i
End With
End Sub``````

#### voyto

##### New Member
Try
VBA Code:
``````Private Sub Workbook_Open()
Dim i As Long, j As Long

j = 8
With Sheets("Start")
.Range("A8:C100").ClearContents
For i = 3 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then
With .Range("A" & j)
.Value = Sheets(i).Name
.Offset(, 1).Value = Sheets(i).Range("H20").Value
.Offset(, 2).Value = Sheets(i).Range("A9").Value
j = j + 1
End With
End If
Next i
End With
End Sub``````
I can't thank you enough! That's saved me loads of time.

Last edited by a moderator:

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Replies
9
Views
432
Replies
0
Views
144
Replies
2
Views
144
Replies
2
Views
51
Replies
0
Views
62

### Forum statistics

1,129,924
Messages
5,639,025
Members
417,064
Latest member
oryngirl ### 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.

### Which adblocker are you using?    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

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