Protected worksheet - filter on one column only?

TheWennerWoman

Active Member
Joined
Aug 1, 2019
Messages
270
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was pointed in this direction by a colleague who told me if I needed an answer to an Excel question, then this was the place to be. So here I am :)

I have a spreadsheet (Office 365). One of the worksheets is 99% protected - there are a couple of cells that the users can enter parameters that are passed into a SQL query.

I have been asked if it's possible for one user to be able to filter a single column (column C).

I can't see any way to do this; it seems that when you protect the sheet, you can tick to allow autofiltering but that applies to every column whereas I just need column C to be unprotected.

Is this possible?

Many thanks for your time.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If you unprotect the sheet, select column C, on the data tab select "Filter", then reprotect the sheet.
You can then only filter on col C
 
Upvote 0
If you unprotect the sheet, select column C, on the data tab select "Filter", then reprotect the sheet.
You can then only filter on col C

Ahh, that works on a normal data range.

I have discovered today that it's a table; so you either have a filter on all columns or none.

Thank you for your reply, is anything possible with a table?
 
Upvote 0
Iy you're Ok with VBA.
Unlock the sheet & run this
Code:
Sub TheWennerWoman()
   Dim i As Long
   
   With Sheets("[COLOR=#ff0000]Sheet1[/COLOR]").ListObjects("[COLOR=#ff0000]table1[/COLOR]")
      For i = 1 To .HeaderRowRange.Columns.Count
         If i <> 3 Then .Range.AutoFilter Field:=i, VisibleDropDown:=False
      Next i
   End With
End Sub
Change sheet name & table name in red to suit.
Then reprotect the sheet & you should be good to go.
 
Upvote 0
Solution
Iy you're Ok with VBA.
Unlock the sheet & run this
Code:
Sub TheWennerWoman()
   Dim i As Long
   
   With Sheets("[COLOR=#ff0000]Sheet1[/COLOR]").ListObjects("[COLOR=#ff0000]table1[/COLOR]")
      For i = 1 To .HeaderRowRange.Columns.Count
         If i <> 3 Then .Range.AutoFilter Field:=i, VisibleDropDown:=False
      Next i
   End With
End Sub
Change sheet name & table name in red to suit.
Then reprotect the sheet & you should be good to go.

Outstanding, how you guys do this stuff is beyond me.

Many thanks.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top