ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   vba code on autofilter (https://www.excelbanter.com/excel-discussion-misc-queries/197818-vba-code-autofilter.html)

UB

vba code on autofilter
 
Hi
I have range of cell from b2:g40 and I want to hide the the rows if any of
the cells in the range is blank.
Example: if any of the cells in row 2 from b2 to g2 is not blank, i want to
display the row#2. but suppose if all the cells in range b2 to g2 are blank,
I want to hide the row #2
I want to go this for 40 rows.
Can you please advise some VBA code on this

Gary''s Student

vba code on autofilter
 
You don't need vba, just a helper column. In H2, enter:

=IF(COUNTBLANK(B2:G2)=6,1,0) and copy down

a value of 1 means that all the cells from B2 to G2 are blanks. Just
AutoFilter on column H to hide all the 1's
--
Gary''s Student - gsnu200798


"ub" wrote:

Hi
I have range of cell from b2:g40 and I want to hide the the rows if any of
the cells in the range is blank.
Example: if any of the cells in row 2 from b2 to g2 is not blank, i want to
display the row#2. but suppose if all the cells in range b2 to g2 are blank,
I want to hide the row #2
I want to go this for 40 rows.
Can you please advise some VBA code on this



All times are GMT +1. The time now is 04:52 PM.

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