Sheets Name

E

Emece

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.-
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SUMIF Formula Help 8
Fals Result in IF Formula 1
Excel Formula Help! 2
Convert hours to minutes 2
Had to repost it!!! 1
Complicated Look-Up 1
Vlookup help 1
macro criteria copy 9

Top