ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning Macro Problem (https://www.excelbanter.com/excel-programming/308804-assigning-macro-problem.html)

mai[_2_]

Assigning Macro Problem
 
Hi, I'm trying to assign my macro to an action or event (I think I'
using the correct jargon).

When my user goes in to delete a worksheet, I want to call m
'DeleteSheet' subroutine.

So I would have something like:

Private Sub Workbook_Activate()

If ActiveWorkSheet.Delete then Call DeleteSheet
End If

End Sub

Will this macro always run in the background or can I specify it to ru
only when user tries to delete?

Thanks

--
Message posted from http://www.ExcelForum.com


Jim Rech

Assigning Macro Problem
 
There is no delete sheet event. If you want to trap the user deleting a
worksheet I'd suggest that you protect the workbook so that he cannot
directly do a sheet delete, and then provide a macro, attached to a menu,
toolbutton, etc., that does the delete.

--
Jim Rech
Excel MVP
"mai " wrote in message
...
| Hi, I'm trying to assign my macro to an action or event (I think I'm
| using the correct jargon).
|
| When my user goes in to delete a worksheet, I want to call my
| 'DeleteSheet' subroutine.
|
| So I would have something like:
|
| Private Sub Workbook_Activate()
|
| If ActiveWorkSheet.Delete then Call DeleteSheet
| End If
|
| End Sub
|
| Will this macro always run in the background or can I specify it to run
| only when user tries to delete?
|
| Thanks.
|
|
| ---
| Message posted from http://www.ExcelForum.com/
|



mai[_3_]

Assigning Macro Problem
 
And there's no way for me to hard code the delete sheet event?


---
Message posted from http://www.ExcelForum.com/


Myrna Larson

Assigning Macro Problem
 
You mean create a new event that fires when a worksheet is delete? No, there's
no way to do this.

On Thu, 2 Sep 2004 14:25:31 -0500, mai
wrote:

And there's no way for me to hard code the delete sheet event?


---
Message posted from http://www.ExcelForum.com/



mai[_4_]

Assigning Macro Problem
 
Darn, I thought Excel could do EVERYTHING! Oh well. Thanks fo
responding! I really appreciate it

--
Message posted from http://www.ExcelForum.com



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

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