Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using auto filter after my worksheet is protected | Excel Worksheet Functions | |||
Help with using Auto-filter in a protected Worksheet. | Excel Discussion (Misc queries) | |||
Auto Filter with Protected Worksheet | Excel Worksheet Functions | |||
Auto Filter - Protected sheet/workbook | Excel Discussion (Misc queries) | |||
how to i use auto filter on a protected worksheet | Excel Programming |