How To Get Sheet Names Using VBA in Microsoft Excel
In case you want to find out a way which can get you all the names of the sheet that are visible i.e. not hidden.
In this article, we will learn how to get names of the visible sheets only, using VBA code.
Question): I have multiple sheets in one file & I have hidden the sheets which I do not want others to see; I want a code that will give me the name of all the visible sheets.
Let us consider we have 5 sheets & we intentionally hide a particular sheet.
To get name of the visible sheets, we need to follow the below steps:
Copy the below code in the standard module
Dim i As Integer, j As Integer: j = 1
For i = 1 To Sheets.Count
If Sheets(i).Visible = -1 Then
Cells(j, 1) = Sheets(i).Name
j = j + 1
In this way, we can get the name of all the visible sheets, using vba code.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.