Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
George
 
Posts: n/a
Default Excel Auto Filter Function

On my spread sheet I am using the Auto Filter and it works ok. My problem is
the spread sheet is shared on a LAN my all the office personnel use it and no
one ever puts all the columns back to the sort "All" default. Is there a way
to make the spread sheet when its closed reset all columns to the "All"
default so the next person doesn't have to make all the corrections to return
the sheet to it's normal view.

Thanks - George
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elkar
 
Posts: n/a
Default Excel Auto Filter Function

Add this to the Workbook Open code:


Private Sub Workbook_Open()
Sheets("sheetname").Select
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=2
Selection.AutoFilter Field:=3
End Sub


Replace sheetname with the name of your worksheet containing the AutoFilter.
And add as many lines as necessary for each column that is filtered.

HTH,
Elkar


"George" wrote:

On my spread sheet I am using the Auto Filter and it works ok. My problem is
the spread sheet is shared on a LAN my all the office personnel use it and no
one ever puts all the columns back to the sort "All" default. Is there a way
to make the spread sheet when its closed reset all columns to the "All"
default so the next person doesn't have to make all the corrections to return
the sheet to it's normal view.

Thanks - George

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
George
 
Posts: n/a
Default Excel Auto Filter Function

Thanks - I just need to figure out the workbook open code

George


"Elkar" wrote:

Add this to the Workbook Open code:


Private Sub Workbook_Open()
Sheets("sheetname").Select
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=2
Selection.AutoFilter Field:=3
End Sub


Replace sheetname with the name of your worksheet containing the AutoFilter.
And add as many lines as necessary for each column that is filtered.

HTH,
Elkar


"George" wrote:

On my spread sheet I am using the Auto Filter and it works ok. My problem is
the spread sheet is shared on a LAN my all the office personnel use it and no
one ever puts all the columns back to the sort "All" default. Is there a way
to make the spread sheet when its closed reset all columns to the "All"
default so the next person doesn't have to make all the corrections to return
the sheet to it's normal view.

Thanks - George

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elkar
 
Posts: n/a
Default Excel Auto Filter Function

When your workbook is open, hit Alt-F11 to open the Visual Basic Editor.

On the left side of the screen, you should see a "Project Window". In this
window you should find an item called "ThisWorkbook" with a little Excel
Worksheet icon next to it. Double click this.

Now you should have a new window open on the right side of the screen called
"WorkbookName - ThisWorkbook (Code)"

Paste the code below in that window. Modify as needed. Then close the
Visual Basic Editor and save your workbook. Now, hopefully, it should clear
any criteria out of the AutoFilter whenever the workbook is opened.


"George" wrote:

Thanks - I just need to figure out the workbook open code

George


"Elkar" wrote:

Add this to the Workbook Open code:


Private Sub Workbook_Open()
Sheets("sheetname").Select
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=2
Selection.AutoFilter Field:=3
End Sub


Replace sheetname with the name of your worksheet containing the AutoFilter.
And add as many lines as necessary for each column that is filtered.

HTH,
Elkar


"George" wrote:

On my spread sheet I am using the Auto Filter and it works ok. My problem is
the spread sheet is shared on a LAN my all the office personnel use it and no
one ever puts all the columns back to the sort "All" default. Is there a way
to make the spread sheet when its closed reset all columns to the "All"
default so the next person doesn't have to make all the corrections to return
the sheet to it's normal view.

Thanks - George

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Excel Auto Filter Function

One way:

Option Explicit
Sub auto_open()
Dim wks As Worksheet
On Error Resume Next
For Each wks In ThisWorkbook.Worksheets
wks.ShowAllData
Next wks
On Error GoTo 0
End Sub

or if you like checking first...

Option Explicit
Sub auto_open()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If wks.AutoFilterMode Then
If wks.FilterMode Then
wks.ShowAllData
End If
End If
Next wks
End Sub





George wrote:

On my spread sheet I am using the Auto Filter and it works ok. My problem is
the spread sheet is shared on a LAN my all the office personnel use it and no
one ever puts all the columns back to the sort "All" default. Is there a way
to make the spread sheet when its closed reset all columns to the "All"
default so the next person doesn't have to make all the corrections to return
the sheet to it's normal view.

Thanks - George


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Excel Auto Filter Function

Ps. I used the Auto_open subroutine.

If you reset the filter when they were closing the workbook, then you'd have to
save it in that state. And if the user opened the workbook and did a lot of
damage and wanted to close without saving, your code that did the save could
really make you sad.

George wrote:

On my spread sheet I am using the Auto Filter and it works ok. My problem is
the spread sheet is shared on a LAN my all the office personnel use it and no
one ever puts all the columns back to the sort "All" default. Is there a way
to make the spread sheet when its closed reset all columns to the "All"
default so the next person doesn't have to make all the corrections to return
the sheet to it's normal view.

Thanks - George


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Custom Excel Function to Calculate Gini Coefficients [email protected] Excel Worksheet Functions 3 February 21st 06 10:15 PM
@ and "function not valid" error (Excel 2003) Acert93 New Users to Excel 1 September 2nd 05 07:17 AM
Averaging Values in Auto Filter Mr. Jan Park Excel Worksheet Functions 1 August 3rd 05 03:51 PM
Restore the auto save function, it was a life saver. JJB Excel Discussion (Misc queries) 1 May 20th 05 01:25 PM
CONVERT Function Disappered in Excel Gord Dibben Excel Discussion (Misc queries) 3 April 13th 05 07:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"