#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Date as Sheet Name

I am trying to take a date from each sheet and name the tab. Each
date is in Range("F10") Here is the code I have so far. I can get it
to transfer names and other things, but it reads dates with the /
character, which excel does not liek to have in the name of a sheet.

Sub ListSheets()
Application.Calculation = xlCalculationManual

Dim ws As Worksheet
Dim Str As String
Dim x As Integer

x = 1
For Each ws In Worksheets

Str = Range("F10")
ws.Name = Str
x = x + 1
Next ws
Application.Calculation = xlCalculationAutomatic
End Sub

Thanks,
Jay
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Date as Sheet Name

On Feb 3, 10:06*am, jlclyde wrote:
I am trying to take a date from each sheet and name the tab. *Each
date is in Range("F10") *Here is the code I have so far. *I can get it
to transfer names and other things, but it reads dates with the /
character, which excel does not liek to have in the name of a sheet.

Sub ListSheets()
Application.Calculation = xlCalculationManual

Dim ws As Worksheet
Dim Str As String
Dim x As Integer

x = 1
For Each ws In Worksheets

* * Str = Range("F10")
* * ws.Name = Str
* * *x = x + 1
Next ws
Application.Calculation = xlCalculationAutomatic
End Sub

Thanks,
Jay


Sub ListSheets()
Application.Calculation = xlCalculationManual

Dim ws As Worksheet
Dim Str As String
Dim x As Integer

x = 1
For Each ws In Worksheets

Str = Application.WorksheetFunction.Text(ws.Range("F10") , "mmm dd
yy")
ws.Name = Str
x = x + 1
Next ws
Application.Calculation = xlCalculationAutomatic
End Sub

I figured it out. Change the dates to text formatted how you would
liek to see them on the sheet tabs and then put them in.

Thanks,
Jay
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Date as Sheet Name

Jay,

Use this for Str:

Str = Format(ws.Range("F10").Value, "mmm dd yyyy")


Replace the mmm dd yyyy with any valid date format that you prefer, and leave out the /s.

HTH,
Bernie
MS Excel MVP


"jlclyde" wrote in message
...
I am trying to take a date from each sheet and name the tab. Each
date is in Range("F10") Here is the code I have so far. I can get it
to transfer names and other things, but it reads dates with the /
character, which excel does not liek to have in the name of a sheet.

Sub ListSheets()
Application.Calculation = xlCalculationManual

Dim ws As Worksheet
Dim Str As String
Dim x As Integer

x = 1
For Each ws In Worksheets

Str = Range("F10")
ws.Name = Str
x = x + 1
Next ws
Application.Calculation = xlCalculationAutomatic
End Sub

Thanks,
Jay



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
macro to: Add new sheet, then rename new sheet with todays date Paul Excel Worksheet Functions 3 September 29th 07 03:17 AM
copying date from one sheet to another work sheet Jay Excel Worksheet Functions 13 September 25th 06 10:56 PM
how to use sumif function to check date in 1 sheet is < 2 sheet Bharat Saboo Excel Worksheet Functions 3 December 30th 05 07:10 AM
Putting the date as a sheet name matthewwookie Excel Discussion (Misc queries) 3 September 26th 05 04:36 PM
Max Date and Item - How to get in one sheet ? [email protected] Excel Worksheet Functions 5 April 21st 05 05:45 PM


All times are GMT +1. The time now is 05:23 PM.

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

About Us

"It's about Microsoft Excel"