Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Auto-Filter When Workbook Protected

Hi everyone,

I'm copying data from several workbooks in a Folder to a separate summary
sheet. I really like the Auto Filter (Custom Filter...) in Excel. It would
be REALLY REALLY great to have a macro that can do just about the same thing
as what (Custom Filter...) does. By the same, I mean the CRITERIA section of
"equal", "not equal", "greater than" and so on... (You get the point)

However, since I'm suck with Macro or VBA, I'm trying to have creative way
to get my work done. So I'm thinking about why not copying everything to the
summary sheet and then do a custom filtering of auto-filter. But again, I
hit another bump. They are disable by default if the sheet is protected.
The reason I have my sheet protected is I don't others to mess up the formula
in there.

So does anyone knows if there is a way to either IMPLEMENT custom filtering
of Auto Filter in Macro or Enable Custom Filtering when sheet is protected?

Thanks for any help!
Neon520
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Auto-Filter When Workbook Protected

Sub auto_filter()
With Sheets("Sheet1")
.Range("A1").AutoFilter
.Protect Password:="justme", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

There are other ways to run the code.

Sheet_Activate event comes to mind.


Gord Dibben MS Excel MVP

On Wed, 24 Dec 2008 09:50:01 -0800, Neon520
wrote:

Hi everyone,

I'm copying data from several workbooks in a Folder to a separate summary
sheet. I really like the Auto Filter (Custom Filter...) in Excel. It would
be REALLY REALLY great to have a macro that can do just about the same thing
as what (Custom Filter...) does. By the same, I mean the CRITERIA section of
"equal", "not equal", "greater than" and so on... (You get the point)

However, since I'm suck with Macro or VBA, I'm trying to have creative way
to get my work done. So I'm thinking about why not copying everything to the
summary sheet and then do a custom filtering of auto-filter. But again, I
hit another bump. They are disable by default if the sheet is protected.
The reason I have my sheet protected is I don't others to mess up the formula
in there.

So does anyone knows if there is a way to either IMPLEMENT custom filtering
of Auto Filter in Macro or Enable Custom Filtering when sheet is protected?

Thanks for any help!
Neon520


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Auto-Filter When Workbook Protected

Thanks for your quick respond, Gord.

I tried the code that you gave me, but Nothing really happen. The screen
just flash, and nothing really get sorted, or if I can choose any filtering
criteria.

Is there a way that I can still have the custom filtering?

Here is the code that I tried:

Sub auto_filter()
With Sheets("Final")
..Unprotect Password:="justme"
..Range("A6:A38").AutoFilter
..Protect Password:="justme", userinterfaceonly:=True
..EnableAutoFilter = True
End With
End Sub

Neon520
"Gord Dibben" wrote:

Sub auto_filter()
With Sheets("Sheet1")
.Range("A1").AutoFilter
.Protect Password:="justme", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

There are other ways to run the code.

Sheet_Activate event comes to mind.


Gord Dibben MS Excel MVP

On Wed, 24 Dec 2008 09:50:01 -0800, Neon520
wrote:

Hi everyone,

I'm copying data from several workbooks in a Folder to a separate summary
sheet. I really like the Auto Filter (Custom Filter...) in Excel. It would
be REALLY REALLY great to have a macro that can do just about the same thing
as what (Custom Filter...) does. By the same, I mean the CRITERIA section of
"equal", "not equal", "greater than" and so on... (You get the point)

However, since I'm suck with Macro or VBA, I'm trying to have creative way
to get my work done. So I'm thinking about why not copying everything to the
summary sheet and then do a custom filtering of auto-filter. But again, I
hit another bump. They are disable by default if the sheet is protected.
The reason I have my sheet protected is I don't others to mess up the formula
in there.

So does anyone knows if there is a way to either IMPLEMENT custom filtering
of Auto Filter in Macro or Enable Custom Filtering when sheet is protected?

Thanks for any help!
Neon520



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Auto-Filter When Workbook Protected

Where did "sorted" come into this?

You haven't enabled "sorting" in the code.

The code you posted to set an AF arrow at A6 works for me and I can choose a
custom filter from there.

BUT............you cannot filter on just the range A6:A38 if data exists in
column A below A38 unless row 39 is blank.


Gord

On Wed, 24 Dec 2008 11:40:03 -0800, Neon520
wrote:

Thanks for your quick respond, Gord.

I tried the code that you gave me, but Nothing really happen. The screen
just flash, and nothing really get sorted, or if I can choose any filtering
criteria.

Is there a way that I can still have the custom filtering?

Here is the code that I tried:

Sub auto_filter()
With Sheets("Final")
.Unprotect Password:="justme"
.Range("A6:A38").AutoFilter
.Protect Password:="justme", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

Neon520
"Gord Dibben" wrote:

Sub auto_filter()
With Sheets("Sheet1")
.Range("A1").AutoFilter
.Protect Password:="justme", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

There are other ways to run the code.

Sheet_Activate event comes to mind.


Gord Dibben MS Excel MVP

On Wed, 24 Dec 2008 09:50:01 -0800, Neon520
wrote:

Hi everyone,

I'm copying data from several workbooks in a Folder to a separate summary
sheet. I really like the Auto Filter (Custom Filter...) in Excel. It would
be REALLY REALLY great to have a macro that can do just about the same thing
as what (Custom Filter...) does. By the same, I mean the CRITERIA section of
"equal", "not equal", "greater than" and so on... (You get the point)

However, since I'm suck with Macro or VBA, I'm trying to have creative way
to get my work done. So I'm thinking about why not copying everything to the
summary sheet and then do a custom filtering of auto-filter. But again, I
hit another bump. They are disable by default if the sheet is protected.
The reason I have my sheet protected is I don't others to mess up the formula
in there.

So does anyone knows if there is a way to either IMPLEMENT custom filtering
of Auto Filter in Macro or Enable Custom Filtering when sheet is protected?

Thanks for any help!
Neon520




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Auto-Filter When Workbook Protected

There may be other ways to do what you want.

One example.................If running 2003 you can turn A6:A38 into a List
from DataListCreate List

In 2007 I believe it would be a Table

You can then filter within that list alone on a protected sheet.

Copy this code below into the sheet module. Right-click on sheet tab and
"View Code" to access that module.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim objlist As ListObject
Set objlist = Me.ListObjects(1) 'adjust the (1) if needed
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, objlist.Range) Is Nothing Then
Me.Unprotect Password:="justme"
Else
With Me
.Protect Password:="justme"
.EnableSelection = xlNoRestrictions
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

When you click inside the List range you can filter, insert or delete rows
and columns within the List.

When you click outside the List range, locked cells are protected from
change.


Gord

On Wed, 24 Dec 2008 12:15:08 -0800, Gord Dibben <gorddibbATshawDOTca wrote:

Where did "sorted" come into this?

You haven't enabled "sorting" in the code.

The code you posted to set an AF arrow at A6 works for me and I can choose a
custom filter from there.

BUT............you cannot filter on just the range A6:A38 if data exists in
column A below A38 unless row 39 is blank.


Gord

On Wed, 24 Dec 2008 11:40:03 -0800, Neon520
wrote:

Thanks for your quick respond, Gord.

I tried the code that you gave me, but Nothing really happen. The screen
just flash, and nothing really get sorted, or if I can choose any filtering
criteria.

Is there a way that I can still have the custom filtering?

Here is the code that I tried:

Sub auto_filter()
With Sheets("Final")
.Unprotect Password:="justme"
.Range("A6:A38").AutoFilter
.Protect Password:="justme", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

Neon520
"Gord Dibben" wrote:

Sub auto_filter()
With Sheets("Sheet1")
.Range("A1").AutoFilter
.Protect Password:="justme", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

There are other ways to run the code.

Sheet_Activate event comes to mind.


Gord Dibben MS Excel MVP

On Wed, 24 Dec 2008 09:50:01 -0800, Neon520
wrote:

Hi everyone,

I'm copying data from several workbooks in a Folder to a separate summary
sheet. I really like the Auto Filter (Custom Filter...) in Excel. It would
be REALLY REALLY great to have a macro that can do just about the same thing
as what (Custom Filter...) does. By the same, I mean the CRITERIA section of
"equal", "not equal", "greater than" and so on... (You get the point)

However, since I'm suck with Macro or VBA, I'm trying to have creative way
to get my work done. So I'm thinking about why not copying everything to the
summary sheet and then do a custom filtering of auto-filter. But again, I
hit another bump. They are disable by default if the sheet is protected.
The reason I have my sheet protected is I don't others to mess up the formula
in there.

So does anyone knows if there is a way to either IMPLEMENT custom filtering
of Auto Filter in Macro or Enable Custom Filtering when sheet is protected?

Thanks for any help!
Neon520





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Auto-Filter When Workbook Protected

Hi Gord,

I'm not sure if it makes any difference or not in this case that I'm using
Office 2004 for Mac. I know that it supports Macro and VBA, except some
codes are different from the Office for Window.

In Office 04, there's actually a List Wizard that help user to generate
list. And you're right. My list is A6:K38 with A6:A36 as Header Row and
A39:K39 as Total Row. When I put your code as you instructed, here is an
error message that I receive:

Run-time error €˜9:
Subscript out of range

I tried play around with it by changing the Set objlist =
Me.ListObjects(1) << to different number, but nothing really works.

FYI, I did tried a solution found in Office Online Website posted by MS he
http://office.microsoft.com/en-us/ex...982701033.aspx

Private Sub Workbook_Open()
Sheet1.Protect password:="test", DrawingObjects:=True, _
contents:=True, Scenarios:=True, _
userinterfaceonly:=True
Sheet1.EnableAutoFilter = True
End Sub

But it doesn't work at all. Is this because I'm using Office for Mac?

Please explain?

Thanks,
Neon520
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
Using auto filter after my worksheet is protected LY Excel Worksheet Functions 2 July 28th 08 12:10 PM
Help with using Auto-filter in a protected Worksheet. Ayo Excel Discussion (Misc queries) 5 October 29th 07 04:10 PM
Auto Filter with Protected Worksheet JohnGuts Excel Worksheet Functions 4 April 24th 06 09:14 AM
Auto Filter - Protected sheet/workbook ronwill Excel Discussion (Misc queries) 3 January 10th 06 03:28 PM
how to i use auto filter on a protected worksheet shirley Excel Programming 1 March 2nd 04 11:26 AM


All times are GMT +1. The time now is 06:32 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"