#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Grouping

Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?
Situation:
I have an Excel file that has multiple worksheets within it that is updated
with grouping on to make changes to multiple worksheets within this file at
the same time; occassionally i have users that forget to ungroup those
selected sheets and the next person in that file does not notice and then
their data is entered into all the worksheets causing a great deal of
confusion.

Please help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Grouping

In Thisworkbook module...............

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ActiveWindow.SelectedSheets.Count 1 Then
MsgBox "Ungroup sheets before closing"
Cancel = True
End If
End Sub


Gord Dibben MS Excel MVP

On Wed, 25 Jul 2007 15:22:01 -0700, Holly
wrote:

Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?
Situation:
I have an Excel file that has multiple worksheets within it that is updated
with grouping on to make changes to multiple worksheets within this file at
the same time; occassionally i have users that forget to ungroup those
selected sheets and the next person in that file does not notice and then
their data is entered into all the worksheets causing a great deal of
confusion.

Please help!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Grouping


Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?


Yes. If sheets are grouped, the vba code below will alert you when exiting.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ActiveWindow.SelectedSheets.Count 1 Then
a = MsgBox("Worksheets are grouped. Continue exiting? (If No,
remember to resave after ungrouping.)", vbYesNo)
If a = vbNo Then Cancel = True
End If
End Sub

To install, copy the code, bring up the Visual Basic editor (Alt + F11),
doubleclick "ThisWorkbook" under your file's VBAProject, paste, and save.

- David
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Grouping

Have you thought about putting the same kind of routine in the workbook_open or
auto_open procedures.

Then you don't have to bother the person closing the workbook with any prompt or
a reminder to save.

Option Explicit
Sub auto_open()
ActiveSheet.Select
End Sub

Holly wrote:

Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?
Situation:
I have an Excel file that has multiple worksheets within it that is updated
with grouping on to make changes to multiple worksheets within this file at
the same time; occassionally i have users that forget to ungroup those
selected sheets and the next person in that file does not notice and then
their data is entered into all the worksheets causing a great deal of
confusion.

Please help!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Grouping

There's Dave again.

Starting from the beginning instead of at the rear end like those of us who just
see the words OP posted and comply with that.

Much easier on users your way.


Gord

On Wed, 25 Jul 2007 21:11:48 -0500, Dave Peterson
wrote:

Have you thought about putting the same kind of routine in the workbook_open or
auto_open procedures.

Then you don't have to bother the person closing the workbook with any prompt or
a reminder to save.

Option Explicit
Sub auto_open()
ActiveSheet.Select
End Sub

Holly wrote:

Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?
Situation:
I have an Excel file that has multiple worksheets within it that is updated
with grouping on to make changes to multiple worksheets within this file at
the same time; occassionally i have users that forget to ungroup those
selected sheets and the next person in that file does not notice and then
their data is entered into all the worksheets causing a great deal of
confusion.

Please help!




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Grouping

Dave, why does your sub work when added to a regular module, but not
to"ThisWorkbook"?

- David

Dave Peterson wrote:
Have you thought about putting the same kind of routine in the workbook_open or
auto_open procedures.

Then you don't have to bother the person closing the workbook with any prompt or
a reminder to save.

Option Explicit
Sub auto_open()
ActiveSheet.Select
End Sub

Holly wrote:
Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Grouping

Auto_open in a general module is the key. Excel knows to look at for that name
(along with auto_close) and do something special.

If you want the same kind of thing under ThisWorkbook, you have to play be
excel's rules and use the _beforeclose (or _beforesave???) event.

It's kind of like Autoexec.bat when you turn on the pc--well, when you used DOS
a hundred years ago!

David Hilberg wrote:

Dave, why does your sub work when added to a regular module, but not
to"ThisWorkbook"?

- David

Dave Peterson wrote:
Have you thought about putting the same kind of routine in the workbook_open or
auto_open procedures.

Then you don't have to bother the person closing the workbook with any prompt or
a reminder to save.

Option Explicit
Sub auto_open()
ActiveSheet.Select
End Sub

Holly wrote:
Is it possible to prompt an alert upon exit of a worksheet alerting the user
that the worksheets are being saved with grouping on?


--

Dave Peterson
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
Grouping Rachana Excel Worksheet Functions 1 October 7th 05 10:19 PM
Grouping Vitruvius Excel Worksheet Functions 1 August 16th 05 09:07 PM
Grouping stuart.young Excel Discussion (Misc queries) 1 August 1st 05 12:56 PM
Grouping Ray Excel Discussion (Misc queries) 0 March 2nd 05 04:51 PM
Grouping Lila Excel Discussion (Misc queries) 1 March 1st 05 03:33 AM


All times are GMT +1. The time now is 01:35 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"