PC Review


Reply
Thread Tools Rate Thread

Advanced Filter in Protected Sheet

 
 
Keith
Guest
Posts: n/a
 
      30th May 2007
I am using the subs below to run an advanced filter filtering data from another sheet.

When I protect the sheet (user to select only unlocked cells) I get a runtime 1004 error.

Any ideas on how to keep this runtime error from happening?

Thanks,
Keith
---------------------------------------------------------------------------------------------------------

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Row = 11 And Target.Column = 5 Then
Worksheets("SurveyResults").Range("C5").Calculate
Worksheets("SurveyResults").Range("data") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("SurveyResults").Range("C5:C6"), _
CopyToRange:=Range("E15:F15"), Unique:=False
End If

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("$E$11") = "" Then Range("$E$11") = "[Make a Selection]"
Range("$J$7") = ActiveCell.Offset(0, -1)
Range("$J$8") = ActiveCell

End Sub
 
Reply With Quote
 
 
 
 
Roger Govier
Guest
Posts: n/a
 
      30th May 2007
Hi Keith

Create a Sub for Protecting the sheet and one for Unprotecting

Call Unprotect at the beginning of your code, then call Protect before your End sub.

--
Regards

Roger Govier


"Keith" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
I am using the subs below to run an advanced filter filtering data from another sheet.

When I protect the sheet (user to select only unlocked cells) I get a runtime 1004 error.

Any ideas on how to keep this runtime error from happening?

Thanks,
Keith
---------------------------------------------------------------------------------------------------------

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Row = 11 And Target.Column = 5 Then
Worksheets("SurveyResults").Range("C5").Calculate
Worksheets("SurveyResults").Range("data") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("SurveyResults").Range("C5:C6"), _
CopyToRange:=Range("E15:F15"), Unique:=False
End If

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("$E$11") = "" Then Range("$E$11") = "[Make a Selection]"
Range("$J$7") = ActiveCell.Offset(0, -1)
Range("$J$8") = ActiveCell

End Sub
 
Reply With Quote
 
Keith
Guest
Posts: n/a
 
      30th May 2007
Roger,
Thanks.
Keith


"Roger Govier" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi Keith

Create a Sub for Protecting the sheet and one for Unprotecting

Call Unprotect at the beginning of your code, then call Protect before your End sub.

--
Regards

Roger Govier


"Keith" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
I am using the subs below to run an advanced filter filtering data from another sheet.

When I protect the sheet (user to select only unlocked cells) I get a runtime 1004 error.

Any ideas on how to keep this runtime error from happening?

Thanks,
Keith
---------------------------------------------------------------------------------------------------------

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Row = 11 And Target.Column = 5 Then
Worksheets("SurveyResults").Range("C5").Calculate
Worksheets("SurveyResults").Range("data") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("SurveyResults").Range("C5:C6"), _
CopyToRange:=Range("E15:F15"), Unique:=False
End If

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("$E$11") = "" Then Range("$E$11") = "[Make a Selection]"
Range("$J$7") = ActiveCell.Offset(0, -1)
Range("$J$8") = ActiveCell

End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced filter to another sheet goayimm Microsoft Excel Misc 1 5th Jun 2008 03:30 AM
Using Advanced Filter w/o having to set focus on the sheet Chris Microsoft Excel Programming 0 6th Aug 2006 12:50 AM
Advanced Filter to another sheet Rishi Dhupar Microsoft Excel Programming 1 8th Feb 2006 07:29 PM
Advanced Filter on Protected Sheets? documike Microsoft Excel Discussion 1 2nd Jan 2005 08:52 PM
Excel will not "show all" from an Advanced Filter on a sheet with protected cells. Gareth Surgenor Microsoft Excel Programming 3 20th May 2004 10:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:23 AM.