+ Reply to Thread
Results 1 to 5 of 5

Clear Filters on Exit

  1. #1
    Registered User
    Join Date
    02-22-2010
    Location
    Solihull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Clear Filters on Exit

    Pretty new on VBA. Seems to be differnt syntax for declaring variables on Private function compared with Public.

    I have this macro which clears and switches off a specific filter in a specific sheet but because I want to to run on File/Exit I need to make it a Private function in This Workbook, but the syntax fail. Ideally I would like to clear and switch off all filtering in all worksheets.

    I'm sure it is very simple so if yu could supply the code it would be great and also perhaps link to the best explaination for the line one syntax for the Private function.

    Many thanks

    Please Login or Register  to view this content.
    Last edited by beegeeblueboy; 02-25-2010 at 04:31 PM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Clear Filters on Exit

    There's no syntactical difference between Private and Public functions - the only difference is where you can call them from.
    What you want is basically:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    02-22-2010
    Location
    Solihull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Clear Filters on Exit

    Quote Originally Posted by romperstomper View Post
    There's no syntactical difference between Private and Public functions - the only difference is where you can call them from.
    What you want is basically:
    Please Login or Register  to view this content.
    Thanks very much. I'm learning all the time. Realised I had get this line in at the beginning
    Please Login or Register  to view this content.
    .

    So everything in This Workbook is invoked when the workbook is opend and closed?

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Clear Filters on Exit

    Quote Originally Posted by beegeeblueboy View Post
    So everything in This Workbook is invoked when the workbook is opend and closed?
    Not exactly - the ThisWorkbook module is where you put code to react to the various events that the workbook exposes - Open, BeforeClose, BeforeSave, BeforePrint etc. You use those events to have code run automatically whenever the user does certain things to the workbook.

  5. #5
    Registered User
    Join Date
    02-22-2010
    Location
    Solihull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Clear Filters on Exit

    Thanks again for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1