Macro on close

S

Skin Paul

Hi all
Excel 2004 11.3.5 On intel imac 4.10.10
Is it possible when I close a sheet or save the workbook it will Auto run a
macro to turn off AutoFilter. I sometimes forget to do it and have to reopen
sheet to turn off. I do not want other users to see filtered lists if they
open this workbook.
Paul
 
B

Bob Greenblatt

Hi all
Excel 2004 11.3.5 On intel imac 4.10.10
Is it possible when I close a sheet or save the workbook it will Auto run a
macro to turn off AutoFilter. I sometimes forget to do it and have to reopen
sheet to turn off. I do not want other users to see filtered lists if they
open this workbook.
Paul
Sure,

Go to the code page of the thisworkbook in question, and use the following:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
worksheets("whatevernameyouhave").showalldata
End Sub

If more than 1 sheet is filtered, add a line for each sheet or a loop for
all sheets:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For each xx in thisworkbook.worksheets
xx.showalldata
next
End Sub
 
S

Skin Paul

Thanks Bob. Much appreciated
Paul


Sure,

Go to the code page of the thisworkbook in question, and use the following:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
worksheets("whatevernameyouhave").showalldata
End Sub

If more than 1 sheet is filtered, add a line for each sheet or a loop for
all sheets:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For each xx in thisworkbook.worksheets
xx.showalldata
next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top