From what I've read you can only change the name of a worksheet by 'SaveAs'. So that means you have to delete the old version and save:
Dim TempWorkbookName as String
TempWorkbookName = ThisWorkbook.FullName
Thisworkbook.SaveAs [G39].Value
Kill TempWorkbookName
Have a nice day, Rickey
To change the name of the sheet (not the workbook),
use:-
' assumes you have already activated the sheet
ActiveSheet.Name = [G39].Value
HTH
Hi Edgar
You will need to use the sheets Code Name to do this. This can be seen in the Project Explorer Window. E.g.
Sub ProtectedOrNot()
On Error GoTo Invalidname
Sheet1.Name = Trim([a1])
Exit Sub
Invalidname:
MsgBox [a1] & "Is not a valid sheet name", vbCritical
End Sub
You dont need the trim but I would leave the on Error.
Dave
- OzGrid Business Applications