Written by Allen Wyatt (last updated January 11, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003
It is not unusual to keep track of monthly information, of one sort or another, in a workbook. You might be tracking expenses, sales, inventory movements, stock prices, or any of a thousand other things. When you start a new month, you may make a copy of the previous month's workbook and then look for a way to make changes to the month name that appears in various places in the newly created copy.
If the month name you want to change is stored as text within various worksheets, you can use Excel's find and replace feature to make the changes. Just follow these steps:
If these steps do not change a particular month name as it appears in your workbook, it could be because the month name is not actually text, but a date value formatted to show only the month. In that case, you cannot use Find and Replace; instead you must simply change the date value stored in the cell.
If you want a quick way to change the month names in the worksheet tabs, that is a bit more tricky. Excel's find and replace feature won't find or replace the text in tab names. Normally they need to be done by hand, but if you have many of them, you may want to create a macro that will do the changing for you. The following macro prompts you for the text you are searching for and the text you want to replace it with. Then, it steps through each worksheet tab and makes the changes for you.
Sub TabReplace() Dim I As Integer, J As Integer Dim sFind As String Dim sReplace As String Dim sTemp As String sFind = InputBox("Text to find?") sReplace = InputBox("Replace it with?") If (sFind & sReplace) = "" Then Exit Sub For I = 1 To Sheets.Count sTemp = Sheets(I).Name J = InStr(sTemp, sFind) While J > 0 sTemp = Left(sTemp, J - 1) & sReplace _ & Mid(sTemp, (J + Len(sFind))) J = InStr(sTemp, sFind) Wend If sTemp <> Sheets(I).Name Then Sheets(I).Name = sTemp End If Next I End Sub
Even though the steps (and macro) presented here can make the job of updating your workbook easier, it may be easier still to simply rethink how you do your workbook. It may be easier to set up a cell to contain the current month's name, and then reference that name in the appropriate cells throughout the workbook. Then, all you need to do is change the month name in a single cell, and it will be changed elsewhere, automatically. In other ExcelTips you even learned how you can dynamically change a tab name based on the contents of a particular cell.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2748) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Changing Months in a Workbook.
Best-Selling VBA Tutorial for Beginners Take your Excel knowledge to the next level. With a little background in VBA programming, you can go well beyond basic spreadsheets and functions. Use macros to reduce errors, save time, and integrate with other Microsoft applications. Fully updated for the latest version of Office 365. Check out Microsoft 365 Excel VBA Programming For Dummies today!
Need to limit the number of characters that can be entered into a cell? One easy way to do it is through the use of Data ...
Discover MoreWhen you create a worksheet, it is common to place headings at the top of each column and the left of each row so you can ...
Discover MoreEnter information into a cell, and Excel needs to figure out what type of information it is. Here's how Excel interprets ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments