List of Tab Names

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
How do I get this to but the list starting in A3?

Code:
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To ThisWorkbook.Sheets.Count
    Sheets(3).Cells(i, 1) = Sheets(i).Name
Next i

End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
How about
Code:
Sheets(3).Cells(i+2, 1) = Sheets(i).Name
 
Last edited:
Upvote 0
The structure of Cells is Cells(row, column).
So change:
Code:
Sheets(3).Cells(i, 1) = Sheets(i).Name
to
Code:
Sheets(3).Cells([COLOR=#ff0000]i+2[/COLOR], 1) = Sheets(i).Name

Note that the column reference can be numeric or the letter. So you could also do:
Code:
Sheets(3).Cells([COLOR=#FF0000]i+2[/COLOR], [COLOR=#ff0000]"A"[/COLOR]) = Sheets(i).Name
 
Upvote 0
What if I wanted to list certain ones (Or not list certain ones - which may be easier). Is there a way to check for a value in a cell in each tab before it lists it?
 
Upvote 0
Something like this
Code:
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To ThisWorkbook.Sheets.Count
   If Sheets(i).Range("A1") = "Fluff" Then Sheets(3).Cells(i+2, 1) = Sheets(i).name
Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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