PC Review


Reply
Thread Tools Rate Thread

Column grouping and hiding being over-ridden when sheet opened

 
 
pignick
Guest
Posts: n/a
 
      22nd May 2009
In a large workbook with a number of worksheets, some worksheets have certain
columns hidden or grouped and normally viewed at level 1. Also, some
worksheets have code that runs on sheet activation and/or de-activation, and
if I move from one of those to a worksheet containing the grouping it is
ungrouped, whereas moving to it from other worksheets doesn't cause the
problem and it remains as saved. Any ideas please?

Also, can someone please explain the difference (if there is any) between
Activate/De-Activate and Open/Close when writing code related to Events.
--
pignick
 
Reply With Quote
 
 
 
 
pignick
Guest
Posts: n/a
 
      27th May 2009
Having had no replies to my initial question, can I explain it in a bit more
detail to see if that helps.

When I move from the worksheet containing the following code to another
worksheet the columns AO are selected in that sheet, and I am trying to
understand why this happens as I thought that "End Sub" stopped the code.

Private Sub WorkSheet_DeActivate()

ActiveSheet.Unprotect
ActiveSheet.Columns("AO").Select
Selection.EntireColumn.Hidden = False
ActiveSheet.Protect

End Sub

I think the same thing must be happening when I move from the sheet
containing that code to another sheet containing some grouped columns that
normally display at level 1, and these get ungrouped (even though the sheet
is protected) presumably because the instruction to unprotect and then unhide
the columns is being given.

No doubt the answer to this is simple and I'm overlooking it, but any help
would be welcome.

--
pignick


"pignick" wrote:

> In a large workbook with a number of worksheets, some worksheets have certain
> columns hidden or grouped and normally viewed at level 1. Also, some
> worksheets have code that runs on sheet activation and/or de-activation, and
> if I move from one of those to a worksheet containing the grouping it is
> ungrouped, whereas moving to it from other worksheets doesn't cause the
> problem and it remains as saved. Any ideas please?
>
> Also, can someone please explain the difference (if there is any) between
> Activate/De-Activate and Open/Close when writing code related to Events.
> --
> pignick

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      27th May 2009
try using

application.enableevents = false

at the beginning of your coding and

application.enableevents = true

at the end.

this will stop your events from triggering other events, which is what
i believe you are describing.
hope that helps!

susan


On May 27, 6:03*am, pignick <pign...@discussions.microsoft.com> wrote:
> Having had no replies to my initial question, can I explain it in a bit more
> detail to see if that helps.
>
> When I move from the worksheet containing the following code to another
> worksheet the columns AO are selected in that sheet, and I am trying to
> understand why this happens as I thought that "End Sub" stopped the code.
>
> Private Sub WorkSheet_DeActivate()
>
> ActiveSheet.Unprotect
> ActiveSheet.Columns("AO").Select
> Selection.EntireColumn.Hidden = False
> ActiveSheet.Protect
>
> End Sub
>
> I think the same thing must be happening when I move from the sheet
> containing that code to another sheet containing some grouped columns that
> normally display at level 1, and these get ungrouped (even though the sheet
> is protected) presumably because the instruction to unprotect and then unhide
> the columns is being given.
>
> No doubt the answer to this is simple and I'm overlooking it, but any help
> would be welcome.
>
> --
> pignick
>
>
>
> "pignick" wrote:
> > In a large workbook with a number of worksheets, some worksheets have certain
> > columns hidden or grouped and normally viewed at level 1. *Also, some
> > worksheets have code that runs on sheet activation and/or de-activation, and
> > if I move from one of those to a worksheet containing the grouping it is
> > ungrouped, whereas moving to it from other worksheets doesn't cause the
> > problem and it remains as saved. * Any ideas please? *

>
> > Also, can someone please explain the difference (if there is any) between
> > Activate/De-Activate and Open/Close when writing code related to Events..
> > --
> > pignick- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
pignick
Guest
Posts: n/a
 
      28th May 2009
Thank you Susan, but I don't think that has fully resolved the problem. I am
out of the office now for a few days but will take another look and try again.
In the meantime if anyone else has any suggestions please post them.
--
pignick


"Susan" wrote:

> try using
>
> application.enableevents = false
>
> at the beginning of your coding and
>
> application.enableevents = true
>
> at the end.
>
> this will stop your events from triggering other events, which is what
> i believe you are describing.
> hope that helps!
>
> susan
>
>
> On May 27, 6:03 am, pignick <pign...@discussions.microsoft.com> wrote:
> > Having had no replies to my initial question, can I explain it in a bit more
> > detail to see if that helps.
> >
> > When I move from the worksheet containing the following code to another
> > worksheet the columns AO are selected in that sheet, and I am trying to
> > understand why this happens as I thought that "End Sub" stopped the code.
> >
> > Private Sub WorkSheet_DeActivate()
> >
> > ActiveSheet.Unprotect
> > ActiveSheet.Columns("AO").Select
> > Selection.EntireColumn.Hidden = False
> > ActiveSheet.Protect
> >
> > End Sub
> >
> > I think the same thing must be happening when I move from the sheet
> > containing that code to another sheet containing some grouped columns that
> > normally display at level 1, and these get ungrouped (even though the sheet
> > is protected) presumably because the instruction to unprotect and then unhide
> > the columns is being given.
> >
> > No doubt the answer to this is simple and I'm overlooking it, but any help
> > would be welcome.
> >
> > --
> > pignick
> >
> >
> >
> > "pignick" wrote:
> > > In a large workbook with a number of worksheets, some worksheets have certain
> > > columns hidden or grouped and normally viewed at level 1. Also, some
> > > worksheets have code that runs on sheet activation and/or de-activation, and
> > > if I move from one of those to a worksheet containing the grouping it is
> > > ungrouped, whereas moving to it from other worksheets doesn't cause the
> > > problem and it remains as saved. Any ideas please?

> >
> > > Also, can someone please explain the difference (if there is any) between
> > > Activate/De-Activate and Open/Close when writing code related to Events..
> > > --
> > > pignick- Hide quoted text -

> >
> > - Show quoted text -

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
When hiding column error messge"Can'nt shift object off sheet" =?Utf-8?B?UmFqZWV2IFNoYXJtYQ==?= Microsoft Excel Misc 1 18th Sep 2006 01:27 PM
Hiding column/row labels --without hiding entire columns/rows daniel.wolff@csfb.com Microsoft Excel Discussion 2 19th Oct 2005 02:28 AM
My Excel Sheet has opened as a mirror image - Column A is on the . =?Utf-8?B?UGhpbGlw?= Microsoft Excel Setup 2 29th Dec 2004 07:28 PM
"Cannot shift objects off sheet" when grouping or hiding =?Utf-8?B?TGFwcGxhbmRlcg==?= Microsoft Excel Crashes 2 11th Feb 2004 07:57 PM
Grouping and Hiding of columns functionality asrivastava Microsoft Excel Programming 0 23rd Oct 2003 08:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:39 AM.