![]() It changes any worksheet with the name kept in the variable Old_Name to a new name kept in the variable New_Name.The punch line of the code is the line Sheets(Old_Name).Name = New_Name.➤ You will find the name of your selected sheet changed beautifully to the desired name ( Sheet1 to January in this example). The 2nd box will ask you to enter the new name of the worksheet. The 1st box will ask you to enter the name of the old sheet that you want to change. Select Rename_Sheet (The name of the Macro) and click on Run. ➤ Then come back to any of your worksheets and press ALT+F8 on your keyboard. ➤ Save the workbook as Excel Macro-Enabled Workbook. ⧪ Step 4: Saving the Macro-Enabled Workbook Sheets(Old_Name).Name = New_Name changes the old name of the worksheet to the new name.New_Name = InputBox(“New Name of the Worksheet: “) asks the user to enter the new name of the worksheet.Old_Name = InputBox(“Name of the Worksheet That You Want to Change: “) asks the user to input the name of the worksheet that he/she wants to change.Sub Rename_Sheet() starts a new Macro called Rename_Sheet.➤ Insert the given VBA code in the opened Module. ➤ A new module window called “Module 1” will open. ➤ From the options available, select Module. ➤ Go to the Insert tab in the VBA window. ⧭ Step by Step Procedure to Run the Macro: ⧪ Note: This code creates a Macro called Rename_Sheet. New_Name = InputBox("New Name of the Worksheet: ") Old_Name = InputBox("Name of the Worksheet That You Want to Change: ") You can use the following code to accomplish this: Renaming a single sheet with VBA is easy. Let’s try to rename a single sheet first. Read More: How to Rename Sheet in Excel (6 Easy and Quick Methods)ġ. Today our objective is to rename the sheets with Visual Basic Application (VBA). The worksheets are named Sheet1, Sheet2, and Sheet3 respectively. Here we’ve three worksheets with the Sales Record of three months of a company called Mars Group. 2 Suitable Approaches to Rename Sheet with VBA in Excel (Single and Multiple Sheets)
0 Comments
Leave a Reply. |