Running a routine upon opening the file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to run a routine like the example below as soon as the worksheet is open to avoid people from altering the list. The original list is hidden starting at D200. I don’t want to use the “protect sheet†because I do make changes to the list. The thing is every time I open this particular worksheet I have to do a “copy – paste†manually which I would like to avoid

Thank you :)
mailto:[email protected]

Private Sub Workbook_Open(
'Upon opening this workbook, it should re-create the lis
'to its original stat

ActiveSheet.Unprotec

Range("D200:E271").Selec
Selection.Cop
Range("B1").Selec
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=Fals
Application.CutCopyMode = Fals
Range("B1").Selec

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=Tru

End Su
 
if you put that in the Thisworkbook module and it should do what you
describe (run when the workbook is opened and the user doesn't choose to
disable macros or in xl2002 and higher, the security level isn't set to high
with no certification).

--
Regards,
Tom Ogilvy

Jjt said:
I would like to run a routine like the example below as soon as the
worksheet is open to avoid people from altering the list. The original list
is hidden starting at D200. I don't want to use the "protect sheet"
because I do make changes to the list. The thing is every time I open this
particular worksheet I have to do a "copy - paste" manually which I would
like to avoid.
 
Why don't you also have protection set and create a button on the toolbar
that links to a macro that unsets it or sets it.

Cake and eat it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Back
Top