Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro won't work today?!?
I have a macro in my Personal.xls that pops up an input box to get a text
string, then searches every cell of each row of the active worksheet for that text. If the text is not found anywhere in that row, the row is hidden and the code searches the next row. Only today it won't work?!? The input box comes up, but the search hides *EVERY* row - even when I can see the word I'm searching for right on the screen!! The only thing I've done is copy this code as a whole block into the worksheet module of another workbook. I haven't fiddled with the original code. So why isn't it working? Any ideas? Ed |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro won't work today?!?
Whoops - forgot the code:
Sub SelectiveRowHide2() Dim myTarget As String Dim myFind As Range Dim i As Integer Dim rng As Range myTarget = Application.InputBox("What text are you searching for?") If ActiveSheet.AutoFilterMode Then Set rng = ActiveSheet.AutoFilter.Range Else Set rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp)) End If Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1) For Each Cell In rng.SpecialCells(xlVisible) i = Cell.Row If Not Rows(i).Hidden Then Rows(i).Select Set myFind = Rows(i).Find(What:=myTarget) If myFind Is Nothing Then Selection.EntireRow.Hidden = True End If End If Next Cell End Sub Ed "Ed" wrote in message ... I have a macro in my Personal.xls that pops up an input box to get a text string, then searches every cell of each row of the active worksheet for that text. If the text is not found anywhere in that row, the row is hidden and the code searches the next row. Only today it won't work?!? The input box comes up, but the search hides *EVERY* row - even when I can see the word I'm searching for right on the screen!! The only thing I've done is copy this code as a whole block into the worksheet module of another workbook. I haven't fiddled with the original code. So why isn't it working? Any ideas? Ed |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro won't work today?!?
Found it. Apparently, I had done a Find and checked Whole Cells only, and
Excel remembered that (stupid program!). So I modified my code to include LookAt:=xlPart, and now it works fine. Ed "Ed" wrote in message ... I have a macro in my Personal.xls that pops up an input box to get a text string, then searches every cell of each row of the active worksheet for that text. If the text is not found anywhere in that row, the row is hidden and the code searches the next row. Only today it won't work?!? The input box comes up, but the search hides *EVERY* row - even when I can see the word I'm searching for right on the screen!! The only thing I've done is copy this code as a whole block into the worksheet module of another workbook. I haven't fiddled with the original code. So why isn't it working? Any ideas? Ed |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro won't work today?!?
Always nice to post your code.
"Ed" wrote in message ... I have a macro in my Personal.xls that pops up an input box to get a text string, then searches every cell of each row of the active worksheet for that text. If the text is not found anywhere in that row, the row is hidden and the code searches the next row. Only today it won't work?!? The input box comes up, but the search hides *EVERY* row - even when I can see the word I'm searching for right on the screen!! The only thing I've done is copy this code as a whole block into the worksheet module of another workbook. I haven't fiddled with the original code. So why isn't it working? Any ideas? Ed |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to update a column in a work based on another work sheet | New Users to Excel | |||
TODAY MACRO | Excel Discussion (Misc queries) | |||
prob with TODAY() within a macro | Excel Discussion (Misc queries) | |||
Open an Excel file with a date as today in a macro | Excel Discussion (Misc queries) | |||
countif(a1:a12,">TODAY()") How do I get this to work? | Excel Worksheet Functions |