ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Deactivate worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/58555-deactivate-worksheet.html)

Cordobes

Deactivate worksheet
 
I want to reorganize and sort a good amount of information on a worksheet,
right before it is deactivate it.

The problem is that when the event deactivate is running, the active sheet
is no longer the one being deactivated, so I have to select it back again,
making it the active sheet, and put in place a set of boolean variables, to
know if this action is taking place before deactivating the sheet, or under a
regular activation.

Any suggestions?

Bob Phillips

Deactivate worksheet
 
If you use the Workbook_SheetDeactivate event, there is sheet argument which
refers tro the sheet exited from.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Cordobes" wrote in message
...
I want to reorganize and sort a good amount of information on a worksheet,
right before it is deactivate it.

The problem is that when the event deactivate is running, the active sheet
is no longer the one being deactivated, so I have to select it back again,
making it the active sheet, and put in place a set of boolean variables,

to
know if this action is taking place before deactivating the sheet, or

under a
regular activation.

Any suggestions?




Cordobes

Deactivate worksheet
 
Could you explain a little bit further, maybe with an example.

Thanks.

"Bob Phillips" wrote:

If you use the Workbook_SheetDeactivate event, there is sheet argument which
refers tro the sheet exited from.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Cordobes" wrote in message
...
I want to reorganize and sort a good amount of information on a worksheet,
right before it is deactivate it.

The problem is that when the event deactivate is running, the active sheet
is no longer the one being deactivated, so I have to select it back again,
making it the active sheet, and put in place a set of boolean variables,

to
know if this action is taking place before deactivating the sheet, or

under a
regular activation.

Any suggestions?





Bob Phillips

Deactivate worksheet
 
Try this code



Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
MsgBox "Previous sheet was" & Sh.Name
MsgBox "Active sheet is " & ActiveSheet.Name
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Cordobes" wrote in message
...
Could you explain a little bit further, maybe with an example.

Thanks.

"Bob Phillips" wrote:

If you use the Workbook_SheetDeactivate event, there is sheet argument

which
refers tro the sheet exited from.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Cordobes" wrote in message
...
I want to reorganize and sort a good amount of information on a

worksheet,
right before it is deactivate it.

The problem is that when the event deactivate is running, the active

sheet
is no longer the one being deactivated, so I have to select it back

again,
making it the active sheet, and put in place a set of boolean

variables,
to
know if this action is taking place before deactivating the sheet, or

under a
regular activation.

Any suggestions?








All times are GMT +1. The time now is 06:43 PM.

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