banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

[VBS] Get the names of all sheets in Excel

  1. To get the name of the current sheet in the current sheet, select any cell and edit the formula:

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)

  1. To get all sheet names in the workbook in the current sheet, use the shortcut Alt+F11 to enter the VBE editor. Insert a new module and enter the following code:

Sub Maco1()
For i = 1 To Sheets.Count
Cells(i, 1) = Sheets(i).Name
Next
End Sub

Then run the specified macro to get the names in the current sheet.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.