Locking Tabs

  • Thread starter Microsoft Communities
  • Start date
M

Microsoft Communities

Is it possible to lock tabs so that someone can not change the position.
Also how would I create a sheet for each day of the month. I was thinking of
putting a date in one cell and then running a macro to create the sheet
using dd-mm-yy format, but I don't know how to make sure the first sheet is
the 01-mm-yy and then make sure it does not go past the end of that month.
 
D

Dave Peterson

You can protect the workbook's structure. This will stop any renaming,
inserting/deleting or moving/copying of sheets.

In xl2003 menus:
tools|Protection|Protect workbook
Check structure
and give it a nice memorable password. But be aware this kind of protection is
easily broken.

And to add sheets for every day of a month, you could use a macro. The workbook
has to be unprotected first.

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim myDate As Date
Dim dCtr As Date

myDate = DateSerial(2009, 7, 1)

With ActiveWorkbook
For dCtr = DateSerial(Year(myDate), Month(myDate), 1) _
To DateSerial(Year(myDate), Month(myDate) + 1, 0)
Set wks = Worksheets.Add(after:=.Sheets(.Sheets.Count))
wks.Name = Format(dCtr, "dd-mm-yy")
Next dCtr
End With
End Sub

Personally, I'd use an unambiguous date format like: dd-mmm-yyyy

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 

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

Top