View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Macro to Hide rows based on value of column F

Sub unhiderows()
Cells.Rows.Hidden = False
End Sub


--
Don Guillett
SalesAid Software

"Scott Marcus" wrote in message
...
I didn't realize that the autofilter would be part of the macro. How would
I
do that without manually recording one? Also, if I go with the one you
sent
me, what would be the macro for the "unhide" button?

Thanks again,
Scott

"Don Guillett" wrote:

An autofilter macro would be best but you could always use a loop

Option Compare Text 'put this line at the top of the regular module

Sub hiderowsif()
lr = Cells(Rows.Count, "a").End(xlUp).Row
For i = lr To 2 Step -1
If Cells(i, "a") = "Withdrawn" Or Cells(i, "a") = "Declined" Then
Rows(i).Hidden = True
Next i
End Sub
--
Don Guillett
SalesAid Software

"Scott Marcus" wrote in message
...
I actually already use autofiler for other purposes. I'm not sure how
it
would work with the filter, unfilter, filter again. Plus, right now the
worksheet is blank. I suppose in order to record a macro where I
rearrange
all the data and the select the ones that I want to hide, I would need
to
make up at least some data to put in just for that purpose. I was
hoping
there was a macro that I could assign to the two buttons that would
just
hide
the rows where "Withdrawn" or "Declined" is in column F or unhide them.

Thanks,
Scott

"Don Guillett" wrote:

use datafilterautofilter. Record a macro if desired. use autofilter
again
or showall to remove the filter.

--
Don Guillett
SalesAid Software

"Scott Marcus" wrote in
message
...
I looked through all the similar questions but couldn't find the
answer
I'm
looking for. I would like to have two buttons. One to "Show Active
Files".
This would hide all rows in which column F has either "Withdrawn" or
"Declined". And the other button would be "Show All Files". This
would
unhide anything that is hidden.

If anyone has any suggestions it would be greatly appreciated.