ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sheets Name (https://www.excelbanter.com/excel-discussion-misc-queries/251093-sheets-name.html)

Emece

Sheets Name
 
I have to do a worksheet where I have to specify data for 2010, one week in
each sheet.

For the sheets name I have to consider a work week, so the sheets name
should be:
Sheet1: 04-01-10 to 08-01-10
Sheet2: 11-01-10 to 15-01-10 and so on

Is there a way to do this automatically?

Thanks in advance.

Regards
Emece.-

Jacob Skaria

Sheets Name
 
You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub Macro()
Dim ws As Worksheet, dtStart As Date, intCount As Integer
dtStart = "04-Jan-2010"

For intCount = 1 To 52
Set ws = Worksheets.Add(After:=Worksheets(Worksheets.Count) )
ws.Name = Format(dtStart, "dd-mm-yy") & " to " & _
Format(dtStart + 4, "dd-mm-yy")
dtStart = dtStart + 7
Next

End Sub

--
Jacob


"Emece" wrote:

I have to do a worksheet where I have to specify data for 2010, one week in
each sheet.

For the sheets name I have to consider a work week, so the sheets name
should be:
Sheet1: 04-01-10 to 08-01-10
Sheet2: 11-01-10 to 15-01-10 and so on

Is there a way to do this automatically?

Thanks in advance.

Regards
Emece.-



All times are GMT +1. The time now is 02:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com