Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why Not Filter the column
Sub Hide_with_Autofilter() Dim HideValue As String Dim rng As Range HideValue = "ron" ' This will hide the rows with "ron" in the Range("A1:A100") With ActiveSheet .Range("A1:A100").AutoFilter Field:=1, Criteria1:=HideValue With ActiveSheet.AutoFilter.Range On Error Resume Next Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _ .SpecialCells(xlCellTypeVisible) On Error GoTo 0 End With .AutoFilterMode = False End With If Not rng Is Nothing Then rng.EntireRow.Hidden = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "tig" wrote in message oups.com... Martin, Thank you for the reply. The method you gave me works pretty well. So I'm a little better off than I was earlier. The only problem is that the range is usually over 1000 rows. So it takes quite a while to go through the loop. Any ideas on speeding it up?? One thing I thought of was to create a named range with the rows with column A = 1, then I could just do Range("test").Rows.Hidden = True. My problem is I'm not sure if I can programmatically populate a named range in a loop like that. And who knows, it might not even be much faster. Let me know if you have any further insights. Thanks again. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hiding rows in a range based on TRUE/FALSE value in each row | Excel Discussion (Misc queries) | |||
Hiding Specific Rows Based on Values in Other Rows | Excel Worksheet Functions | |||
Need help hiding/unhiding column based on autofilter selection in a different column | Excel Programming | |||
Hiding rows based on a value | Excel Discussion (Misc queries) | |||
Hiding rows based on date | Excel Worksheet Functions |