View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Naming worksheet

Hi Anne,

Try:
'=============
Public Sub Tester()
Dim i As Long

i = Worksheets.Count
Worksheets.Add After:=Sheets(i)

On Error Resume Next
ActiveSheet.Name = Format(Date, "dd-mm-yy")
If Err.Number < 0 Then
ActiveSheet.Name = Format(Now, "dd-mm-yy hh mm")
End If
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman



"Arne Hegefors" wrote in message
...
I want to name a worksheet. I want the name to be the current date. If
there
already exists a worksheet with that name I want to add time to the name.
The
problem is that I do not know how to add time to the name of the
worksheet.
pls help me! any help appreciated!

i = Worksheets.Count
Worksheets.Add Count:=1, After:=Sheets(i)

For j = 1 To i
If Sheets(j).Name = Date Then
blnTodaySheet = True
End If
Next

If blnTodaySheet = True Then
Sheets(i + 1).Name = Date + Time
Else
Sheets(i + 1).Name = Date & ":" & Time
End If