PROTECT MULTIPLE SHEETS IN EXCEL WORKBOOK SIMULTANEOUSLY?

S

SEAKAPTAIN

LOOKING FOR WAY T0 PRTECT SEVERAL OR ALL SHEETS IN EXCEL WORKBOOK AT ONCE
WITHOUT HAVING TO DO EACH INDIVIDUALLY. ALSO, CONSECUTIVELY DATE SHEETS IN
WORKBOOK WITHOUT HAVING TO DO INDIVIDUALLY ???
 
D

Dave Peterson

You could use a macro like this:

Option Explicit
Sub testme()
Dim dCtr As Long
Dim wks As Worksheet

dCtr = DateSerial(2008, 10, 2)

For Each wks In ActiveWorkbook.Worksheets
wks.Name = Format(dCtr, "yyyy-mm-dd")
dCtr = dCtr + 1
wks.Protect Password:="TopSecret"
Next wks
End Sub


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