Search for data in Excel and hide rows

B

Bjarne Jensen

Hi newsgroup,

Has come upon an interesting challenge ;-)

I have to search through an Excel sheet for a lot of data. I would like to
have the rows without the searched data to be hidden. Is it possible to do
that in Excel - or is it something like a VBA script?

Inputs are welcome.

I use MS Excel 2007, English

Thanks in advance.

/ Bjarne
 
E

Eduardo

Hi,
An example might help, however if you want to select some data you can use
filters, which will show you only the data filtered
 
L

Luke M

Excel way:
Place an autofilter on your data, and do a custom filter of:
"does not equal", My Data

VBA:

'=============
Sub HideRows()
For each c in Range("D1:D100")
if c.value <> "My Data" then
c.EntireRow.Hidden = True
else
c.EntireRow.Hidden = False
end if
next
End Sub
'===============

Note that the XL way would be faster performance time, while VBA would be
nice if you need to string multiple criteria together.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top