Private Sub Worksheet_Change(ByVal Target As Range)
'Modified 3-20-18 2:20 AM EDT
If Not Intersect(Target, Range("B4")) Is Nothing Then
On Error GoTo M
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
ActiveSheet.Name = Format(Target.Value, "MM-DD-YY")
End If
Exit Sub
M:
MsgBox "That sheet name already exist or is a improper name"
End Sub
This is an auto sheet event script Your Workbook must be Macro enabled To install this code: Right-click on the sheet tab Select View Code from the pop-up context menu Paste the code in the VBA edit window [CODE said:Private Sub Worksheet_Change(ByVal Target As Range)
'Modified 3-20-18 2:20 AM EDT
If Not Intersect(Target, Range("B4")) Is Nothing Then
On Error GoTo M
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
ActiveSheet.Name = Format(Target.Value, "MM-DD-YY")
End If
Exit Sub
M:
MsgBox "That sheet name already exist or is a improper name"
End Sub
[/CODE]
Thank you I have it sorted.
2 things:
1. The code must be entered on the sheet you want to use it. Right click the sheet > View Code > paste code in
2. You don;t have to run the code. Just enter the data into the cell... in this case B4 and the sheet automagically changes.
Thanks for your help My Answer.