Hi hope this helps
Option Explicit
Sub RenameSheet()
Const strKEY_WORD As String = "Account Number"
Dim sh As Worksheet
Dim rToSearch As Range
Dim rFound As Range
Set sh = ActiveSheet
Set rToSearch = sh.Columns("A").Resize(sh.UsedRange.Rows.Count)
' Find the row with the key word.
Set rFound = rToSearch.Find(What:=strKEY_WORD, LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, MatchByte:=False, SearchFormat:=False)
' Check if we found it
If Not rFound Is Nothing Then
sh.Name = Replace$(rFound.Value, strKEY_WORD, vbNullString)
End If
End Sub
Bookmarks