ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding Rows Based on Cell Value (https://www.excelbanter.com/excel-programming/402208-hiding-rows-based-cell-value.html)

LarryP

Hiding Rows Based on Cell Value
 
I need to hide rows based on the value in Column AV, and can't use AutoFilter
because AV is not contiguous with other columns where I am already using
Autofilter for other purposes. I can't move the column to make it contiguous
either, as that would screw up other things.

So I'm looking for code that will say, for each row in the active worksheet,
if AV = "C", hide the row. (Yes, I'd probably want to limit it to only rows
that contain some data, rather than churning through all 65535 rows!) I'm
lost, though, as to how to refer to the relevant cell in column AV. Who can
help?

excelent

Hiding Rows Based on Cell Value
 
sub test()
for each c in range("av1:av1000") ' change range to fit
if c="C" then c.entirerow.hidden=true
next
end sub


"LarryP" skrev:

I need to hide rows based on the value in Column AV, and can't use AutoFilter
because AV is not contiguous with other columns where I am already using
Autofilter for other purposes. I can't move the column to make it contiguous
either, as that would screw up other things.

So I'm looking for code that will say, for each row in the active worksheet,
if AV = "C", hide the row. (Yes, I'd probably want to limit it to only rows
that contain some data, rather than churning through all 65535 rows!) I'm
lost, though, as to how to refer to the relevant cell in column AV. Who can
help?


LarryP

Hiding Rows Based on Cell Value
 
Knew it had to be simpler than I was imagining! Thanks.

"excelent" wrote:

sub test()
for each c in range("av1:av1000") ' change range to fit
if c="C" then c.entirerow.hidden=true
next
end sub


"LarryP" skrev:

I need to hide rows based on the value in Column AV, and can't use AutoFilter
because AV is not contiguous with other columns where I am already using
Autofilter for other purposes. I can't move the column to make it contiguous
either, as that would screw up other things.

So I'm looking for code that will say, for each row in the active worksheet,
if AV = "C", hide the row. (Yes, I'd probably want to limit it to only rows
that contain some data, rather than churning through all 65535 rows!) I'm
lost, though, as to how to refer to the relevant cell in column AV. Who can
help?



All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com