highlighting only filtered rows

F

fgatch

hi,

not sure if this is possible, but i have a large range of unique dat
which i filter through. when i perform a search for a single row an
all other rows are hidden, i'd like to highlight the single filtere
row in yellow. is this possible with a macro? any ideas?

thanks,

Fran
 
T

Tom Ogilvy

Autofilter?

set rng = Activesheet.AutoFilter.Range
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
set rng1 = rng.Columns(1).SpecialCells(xlVisible)
if rng.count = 1 then
rng.Resize(1,rng.columns.count).Select
' or
' rng.Resize(1,rng.columns.count).Interior.ColorIndex = 5
End if

Not sure what you mean by highight. First option selects the row, second
colors it.
 
D

Don Guillett

try

Sub colorvisiblerows()
With Rows("1:" & Range("a" & Rows.Count).End(xlUp).Row)
.Interior.ColorIndex = xlNone
.SpecialCells(xlCellTypeVisible).Interior.ColorIndex = 6
End With
End Sub
 

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