View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Rename sheet with content in specific cell

Sub RenameAllSheets()

Dim ws As Worksheet

For Each ws In Worksheets
On Error Resume Next
ws.Name = ws.Range("A1")
If Err.Number 0 Then
On Error GoTo 0 'Reset error trapping ASAP
MsgBox "Could not rename sheet " & _
ws.Name & vbCrLf & vbCrLf & _
"Probably due to invalid sheet name"
End If
Next ws

End Sub

--
Regards,

OssieMac