View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J_Knowles[_2_] J_Knowles[_2_] is offline
external usenet poster
 
Posts: 25
Default Macro to Un Hide filtered rows

Here's another method:

Sub Macro2()
Range("A1").Select 'select a cell in the filter range
Const csPWORD As String = "123"
ActiveWorkbook.Worksheets("broker").Unprotect Password:=csPWORD
ActiveSheet.AutoFilterMode = False ' turns off auto filter
ActiveWorkbook.Worksheets("broker").Protect Password:=csPWORD
End Sub

HTH
--
Data Hog


"JeffK" wrote:

I have this Macro

Sub Macro2()
Const csPWORD As String = "123"
ActiveWorkbook.Worksheets("broker").Unprotect Password:=csPWORD
ActiveSheet.ShowAllData
ActiveWorkbook.Worksheets("broker").Protect Password:=csPWORD
End Sub

I get a bug error if the sheet is already un filtered and the next step of
protecting the sheet again doesn't happen. How do I change this to search
first to see if the worksheet is filtered and if it is then proceed with the
rest of the Macro.