Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Naming worksheet

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
naming worksheet tabs SHARON Excel Discussion (Misc queries) 1 May 27th 10 11:27 PM
Worksheet naming Woodstock Excel Discussion (Misc queries) 3 January 20th 09 10:35 PM
Naming Worksheet Denis New Users to Excel 2 September 13th 05 05:55 PM
Naming a worksheet help? pauldaddyadams Excel Worksheet Functions 1 August 9th 05 10:46 AM
Creating & Naming a New Worksheet teresa Excel Programming 1 December 13th 04 02:18 PM


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"