In "D22" I have a formula "=H9+3". I want the calculated value of "D22" to
display as a date in the worksheet TAB.
This code looks like it should work with a date, but doesn't
++++
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
Dim wksh As Worksheet
Dim sStr As String
If Target.Address = "D22" Then
If IsDate(Target) Then
sStr = Format(Target.Value, "dd-mmm-yyyy")
' does the sheet already have that name
If Sh.Name = sStr Then Exit Sub
' Does another sheet have that name
On Error Resume Next
Set wksh = Nothing
Set wksh = Worksheets(sStr)
On Error GoTo 0
If Not wksh Is Nothing Then
MsgBox "There is already a sheet with the name " & sStr
Exit Sub
End If
' Everything OK, rename sheet
Sh.Name = sStr
End If
End If
End Sub
++++
Anyone out there have code that works with dates?
Any help would be appreciated!!
Kelvin
Bookmarks