Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
TODAY MACRO Stuart WJG[_2_] Excel Discussion (Misc queries) 2 April 7th 08 04:36 PM
prob with TODAY() within a macro deepika :excel help[_2_] Excel Discussion (Misc queries) 2 February 28th 08 09:52 PM
Open an Excel file with a date as today in a macro Perry Excel Discussion (Misc queries) 4 November 10th 05 09:57 AM
countif(a1:a12,">TODAY()") How do I get this to work? Dan Bork Excel Worksheet Functions 1 November 11th 04 10:54 PM


All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"