Worksheet Deactivate

  • Thread starter Thread starter Graham Haughs
  • Start date Start date
G

Graham Haughs

I am trying to enter code in a worksheet so that when I move to another
worksheet, several columns are hidden in the original worksheet, so that
when I return to it they are hidden. This is the code I am using but
keep getting a de-bug message.

Private Sub Worksheet_Deactivate()
ActiveSheet.Unprotect
Columns("O:Z").EntireColumn.Hidden = True
ActiveSheet.Protect
End Sub

I am sure it probably has something to do with the term Activesheet but
I don't know how to get round it.
I would appreciate any help.

Kind Regards
Graham Haughs
Turriff, Scotland
 
Are you thinking activesheet is the sheet you are coming from or the one you
are going to?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Bob said:
Are you thinking activesheet is the sheet you are coming from or the one you
are going to?
The activesheet is the one I am leaving.
Graham
 
If you use the Workbook_SheetDeactivate workbook event, sh gives you the
sheet you are leaving.
 

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