ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Worksheet with Code (https://www.excelbanter.com/excel-programming/341376-copy-worksheet-code.html)

Bill[_30_]

Copy Worksheet with Code
 
Hello,
I have a sheet that is set up so when someone double clicks a row, a
subroutine is called. I put this code into the worksheet;

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Call Mysub
End Sub

The problem is that someone could delete this sheet. So, I had a copy of it
hidden; I search to see if it is there - if not, I copy the sheet from the
hidden sheet. But the code does not copy. Is there a way to do this? I
don't want to protect the workbook.

Many thanks.

Bill



Jim Thomlinson[_4_]

Copy Worksheet with Code
 
There is a similar option for the double click event in the thisworkbook
module. Why not use that one. Then you don't have to worry about the sheet
being deleted or such. You will have to speicfy how each sheet will (or
won't react to the double click)

--
HTH...

Jim Thomlinson


"Bill" wrote:

Hello,
I have a sheet that is set up so when someone double clicks a row, a
subroutine is called. I put this code into the worksheet;

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Call Mysub
End Sub

The problem is that someone could delete this sheet. So, I had a copy of it
hidden; I search to see if it is there - if not, I copy the sheet from the
hidden sheet. But the code does not copy. Is there a way to do this? I
don't want to protect the workbook.

Many thanks.

Bill





All times are GMT +1. The time now is 03:59 AM.

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