Macro to hide entire row if value from 2 columns are blank

BenR

New Member
Joined
Jan 4, 2006
Messages
22
Hello,
I require a macro to hide entire rows based on the criteria of having blank values in BOTH columns C & D.

Thanks in advance

BENR
 
One hit:
Code:
Public Sub HideBlankRows()
    Dim rngToCheck As Range
    
    With ActiveSheet
        Set rngToCheck = Excel.Intersect(.Columns("C:D"), .UsedRange)
    End With
    rngToCheck.SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
End Sub

Assumes that cells are genuinely blank, and not nullstrings e.g. ="".
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
{Admin note} Thread won't paginate! Creating new post to attempt to force pagination.
 
Upvote 0
Heres my list of data ( table 1 ) and the resultant table below ( table 2 )

T1 A B C D F
1 WH4_BL_STK TRUE 1
2 JBS_BL_STK TRUE 1
3 Total [Mill] TRUE 10000 1,700 1
4 Total [Waste] TRUE 50000 1
5 Total [Stockpile] TRUE 1
6 Total [Mill+Waste] TRUE 15,000 1
7 RPG4_CR_DST TRUE 2
8 TGH_CR TRUE 2
9 JB_CR_DST TRUE 2
10 RPG4_CR TRUE 2



T2 A B C D E
3 Total [Mill] TRUE 10000 1,700 1
4 Total [Waste] TRUE 50000 1
6 Total [Mill+Waste] TRUE 15,000 1


Thanks in advance again!!!!!!
 
Upvote 0
<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>

<table class="tableizer-table">
<tr class="tableizer-firstrow"><th></th><th>A</th><th>B</th><th>C</th><th>E</th><th>E</th></tr> <tr><td>1</td><td>WH4_BL_STK</td><td>TRUE</td><td> </td><td> </td><td>1</td></tr> <tr><td>2</td><td>JBS_BL_STK</td><td>TRUE</td><td> </td><td> </td><td>1</td></tr> <tr><td>3</td><td>Total [Mill]</td><td>TRUE</td><td>1000000</td><td>1,700,000</td><td>1</td></tr> <tr><td>4</td><td>Total [Waste]</td><td>TRUE</td><td>50000</td><td> </td><td>1</td></tr> <tr><td>5</td><td>Total [Stockpile]</td><td>TRUE</td><td> </td><td> </td><td>1</td></tr> <tr><td>6</td><td>Total [Mill+Waste]</td><td>TRUE</td><td> </td><td>15,000,000</td><td>1</td></tr> <tr><td>7</td><td>RPG4_CR_DST {WH4}</td><td>TRUE</td><td> </td><td> </td><td>2</td></tr> <tr><td>8</td><td>Newman_CR_DST {WH4}</td><td>TRUE</td><td> </td><td> </td><td>2</td></tr> <tr><td>9</td><td>JB_CR_DST {WH4}</td><td>TRUE</td><td> </td><td> </td><td>2</td></tr> <tr><td>10</td><td>RPG4_CR_DST {WH123}</td><td>TRUE</td><td> </td><td> </td><td>2</td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td>A</td><td>B</td><td>C</td><td>E</td><td>E</td></tr> <tr><td>3</td><td>Total [Mill]</td><td>TRUE</td><td>1000000</td><td>1,700,000</td><td>1</td></tr> <tr><td>4</td><td>Total [Waste]</td><td>TRUE</td><td>50000</td><td> </td><td>1</td></tr> <tr><td>6</td><td>Total [Mill+Waste]</td><td>TRUE</td><td> </td><td>15,000,000</td><td>1</td></tr></table>
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,281
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top