I have a workbook with more than 60 tabs. Each worksheet has a name in the same cell and I want the text in that cell to be the name of the tab for each of the worksheets. Please tell me there is a quick and easy way to do this.
I have a workbook with more than 60 tabs. Each worksheet has a name in the same cell and I want the text in that cell to be the name of the tab for each of the worksheets. Please tell me there is a quick and easy way to do this.
Try this:
Assumes sheet name is in cell A1. Change as needed.![]()
Option Explicit Sub WSName() Dim ws As Worksheet For Each ws In Worksheets ws.Name = ws.Range("A1") Next ws End Sub
How to install your new code
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Press Alt+F11 to open the Visual Basic Editor
Choose Insert > Module
Edit > Paste the macro into the module that appeared
Close the VBEditor
Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
To run the Excel VBA code:
Press Alt-F8 to open the macro list
Select a macro in the list
Click the Run button
Last edited by alansidman; 12-16-2015 at 06:36 PM.
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks