Here is one way to do this via VBA
This method is one I adapted from Bob Umlas so give credit to him.
In a sheet module (the one with the filters)
put this code in.
Option Explicit
Public bflag As Boolean
Private Sub Worksheet_Calculate()
Static bflag
If bflag Then Exit Sub
On Error Resume Next
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End Sub
Now in A1 place this formula;
formula in cell IV1.
IV1 =COUNTA(IV2:IV65536,A:IU)
Now in a module put this code in;
Public bflag
'Run this to deactivate it if you want
'to edit the sheet
Sub ChangeProtectMode()
Static bflag
Dim PW As String
'Run this routine again to Protect the sheet 'IFM
If bflag Then
bflag = False
Range("IV1").FormulaR1C1 = "=COUNTA(R[1]C:R[65535]C,C[-255]:C[-1])"
Exit Sub
Else
PW = InputBox("Password......")
If PW <> "test" Then End
'Replace formula
Range("IV1") = 1
bflag = True
End If
End Sub
The filtering of a list does not trigger the Calculate event. BUT any event that does activates
the Calculate event will trigger this event proc
and undo anything done, so in effect protecting
the sheet.
Ivan
I've tried the above solution but nothing happens.
I'm also a little unclear on the formula and whether
it is to be placed in A1 or IV1.
Further assistance would be appreciated.
Thanks
Andy.
Andy
probably best if I send you an example
Sorr i put you wrong, should be in IV1
Example to come.
Ivan