easy question driving me mad

plost33

Well-known Member
Joined
Oct 2, 2008
Messages
866
I have the following lines of code all it is suppost to do hide the rows where the value in range(b4:B49) are blank/empty. but it is not working.


For lngRow = 4 To 49 'Rows 4 thru 49
With Sht
For Col = 2 To 2 'Column B
If .Cells(lngRow, Col) <> 0 Then Exit For
If Col = 2 Then .Rows(lngRow).Hidden = True
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi Plost
Try this
Code:
Sub hidrow()
Dim r As Long
Application.ScreenUpdating = False
For r = 4 To 49 Step 1 ' HIDES ROWS WITH NOTHING IN "B"
    If Range("B" & r).Value = "" Then
        Rows(r).EntireRow.Hidden = True
    End If
Next r
End Sub

Regards
Michael M
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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