ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   event procedure (https://www.excelbanter.com/excel-programming/414756-event-procedure.html)

Dave

event procedure
 
Hi,
I am using the following in a Worksheet, to prevent the user from using the
fill handle on that particular sheet:

Private Sub Worksheet_Activate()
Application.CellDragAndDrop = False
End Sub

Private Sub Worksheet_Deactivate()
Application.CellDragAndDrop = True
End Sub

However, if the workbook is saved with this sheet active, closed, then
opened, the macro doesn't fire. How can I prevent this from occurring?

Regards - Dave.

Gary''s Student

event procedure
 
Don't let the user save the file with that special worksheet active.

Use the Workbook BeforeSave event to move off the sheet (to an alternative
sheet) prior to saving. When the file is re-opened, it will open with the
alternative sheet active. The user will have to select the special sheet and
the worksheet activate event code will trigger.


--
Gary''s Student - gsnu200796


"Dave" wrote:

Hi,
I am using the following in a Worksheet, to prevent the user from using the
fill handle on that particular sheet:

Private Sub Worksheet_Activate()
Application.CellDragAndDrop = False
End Sub

Private Sub Worksheet_Deactivate()
Application.CellDragAndDrop = True
End Sub

However, if the workbook is saved with this sheet active, closed, then
opened, the macro doesn't fire. How can I prevent this from occurring?

Regards - Dave.


Dave

event procedure
 
Hi GS,
Yeah, of course. D'uh. Thanks.
Regards - Dave.

"Gary''s Student" wrote:

Don't let the user save the file with that special worksheet active.

Use the Workbook BeforeSave event to move off the sheet (to an alternative
sheet) prior to saving. When the file is re-opened, it will open with the
alternative sheet active. The user will have to select the special sheet and
the worksheet activate event code will trigger.




All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com