Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Constrain to visible area?
I have a macro that searchs for a text string and hides any row not
containing the string (code at the end). (I got this from a post on a NG, and tried a Google search so I could give big credits to the original author, but I couldn't find the original post.) It works great, with one small hitch. If I filter my worksheet to show a range selected from the middle of the sheet, because it starts from 2, it will search even what is not visible. Would it be difficult to add some lines to constrain the search area to only what is visible after filtering? It also does this if I try to run it twice. Sub SelectiveRowHide() Dim myTarget As String Dim myFind As Range Dim i As Integer myTarget = Application.InputBox("What text are you searching for?") For i = 2 To Range("A65536").End(xlUp).Row Rows(i).Select Set myFind = Rows(i).Find(What:=myTarget) If myFind Is Nothing Then Selection.EntireRow.Hidden = True End If Next i End Sub Ed |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Chart Area visible but cannot access rows and columns on worksheet | Charts and Charting in Excel | |||
Excel document out of visible area | Excel Discussion (Misc queries) | |||
Constrain data format in cell | Excel Discussion (Misc queries) | |||
how to constrain the sum of a range in solver | Excel Discussion (Misc queries) | |||
column truncated due to width constrain | Excel Worksheet Functions |