From: OssieMac on 11 Feb 2010 01:14 Hi Joe, Try the following. Note the error trapping is essential. However, if re-naming the first sheet with the same name then it does not produce an error. Sub ReNameWorksheet() Dim strShtname As String strShtname = "My New Sht Name" On Error Resume Next ThisWorkbook.Sheets(1).Name = strShtname If Err.Number > 0 Then MsgBox "Cannot re-name worksheet." & vbLf _ & strShtname & " already exists." End If On Error GoTo 0 End Sub -- Regards, OssieMac
|
Pages: 1 Prev: How to evaluate VB constant name in string variable? Next: Value of wdAlertsNone |