Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Worksheet Deactivate

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Worksheet Deactivate

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)


"Graham Haughs" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Worksheet Deactivate

Bob Phillips wrote:
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Worksheet Deactivate

If you use the Workbook_SheetDeactivate workbook event, sh gives you the
sheet you are leaving.

--
HTH

Bob Phillips

"Graham Haughs" wrote in message
...
Bob Phillips wrote:
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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Worksheet Deactivate

Bob Phillips wrote:
If you use the Workbook_SheetDeactivate workbook event, sh gives you the
sheet you are leaving.


Thanks for that Bob

Graham
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pivot chart causes worksheet to deactivate J Owen Excel Discussion (Misc queries) 2 January 22nd 07 07:32 PM
Deactivate worksheet Cordobes Excel Discussion (Misc queries) 3 December 4th 05 10:16 AM
deactivate fullscreen MD Excel Programming 3 March 13th 05 08:52 PM
Deactivate autofill sowetoddid[_53_] Excel Programming 1 June 23rd 04 03:04 AM
Delete Worksheet on DeActivate TJ Walls Excel Programming 3 May 17th 04 06:44 PM


All times are GMT +1. The time now is 07:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"