View Single Post
  #1   Report Post  
Phil Osman
 
Posts: n/a
Default Repeat a command in a Macro

I have a macro that simply looks like this:

Sheets("Template").Select
ActiveSheet.Unprotect
ActiveSheet.Next.Select
ActiveSheet.Unprotect
ActiveSheet.Next.Select
ActiveSheet.Unprotect
etc................

I have 72 sheets, and don't want to keep having to go in and paste in more
lines everytime I add a new sheet.
Is there someway to tell it to repeat the Select & Unprotect lines x number
of times, which would give a MUCH shorter code! Or, maybe there is a way to
tell it to keep repeating that until it gets to the last sheet in the
workbook ???

Phil

--
http://www.redbrick.dcu.ie/~pele