LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro to Hide rows based on value of column F

change to ONE line or use end if as the line after
If Cells(i, "a") = "Withdrawn" Or Cells(i, "a") = "Declined" Then
Rows(i).Hidden = True



--
Don Guillett
SalesAid Software

"Scott Marcus" wrote in message
...
This gives an error message saying "Compile error: next without for"

"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.








 
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 Help Needed: Comparing cell values and deleting rows [email protected] Excel Discussion (Misc queries) 1 September 19th 06 02:39 AM
macro unouwanme Excel Discussion (Misc queries) 9 August 31st 06 09:38 PM
How can I invoke running a macro from within an "IF" function. ron Excel Worksheet Functions 11 February 8th 06 03:35 PM
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Hide column or row based on a cell in the column or row? SacGuy Excel Discussion (Misc queries) 0 January 24th 06 06:51 PM


All times are GMT +1. The time now is 12:30 AM.

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

About Us

"It's about Microsoft Excel"