Hi,
I'm trying to modify the following Vba istructions.
In cells G7 and H3 I have to write different names of nations, but if I delete the contents of cells G7 and H3, I would like to handle the error by renaming again the sheets with the original name (Sheet2 and Sheet7),
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
On Error Resume Next
For Each cell In Target
Select Case cell.Address
Case "$G$7": Sheets(2).Name = cell.Text
Case "$H$3": Sheets(7).Name = cell.Text
End Select
Next cell
'For Each WS In ThisWorkbook.Worksheets
' If StrComp(WS.CodeName, CodeName, vbTextCompare) = 0 Then
' Set GetWorksheetFromCodeName = WS
' Exit Function
' End If
'Next WS
If Err > 0 Then MsgBox "Nome già esistente: prego modificare il nome"
End Sub
I hope my poor English (and very poor description) could be clear.
Regards
Bookmarks