Hide / UnHide Rows w/VBAcode

G

Guest

Guest
Hi, i can hide Unhide 1 row With:

Option Explicit
If Range ("D6") = 0 Then
Range("D6").EntireRow.Hidden = True

If Range ("D6") > 0 Then
Range("D6").EntireRow.Hidden = False
---------
What i'm trying to achive is:
If the Range of ("D6:D1000")has a "0" then
that row is hidden

Thanks for any help,
James
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
On 2002-03-09 12:00, Anonymous wrote:
Hi, i can hide Unhide 1 row With:

Option Explicit
If Range ("D6") = 0 Then
Range("D6").EntireRow.Hidden = True

If Range ("D6") > 0 Then
Range("D6").EntireRow.Hidden = False
---------
What i'm trying to achive is:
If the Range of ("D6:D1000")has a "0" then
that row is hidden

Thanks for any help,
James
James, would autofilter work for you? (You can do this via code if you want).
 
Upvote 0
Hi

Try:

Sub ToggleHide()
Range("D6").EntireRow.Hidden = (Range("D6").Text = "0")
End Sub

You cannot use just Range("D6") as this is the same as Range("D6").Value and the Value of an empty cell is zero, ulles that is what you want of course.
 
Upvote 0

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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