Auto hide fields using macros in MVB

Fmedia

New Member
Joined
Oct 10, 2006
Messages
7
Hi

I am in urgent need of some expert advice. I have a spreadsheet file that has several other dependencies, and looks very messy, as a lot of the cells are redundant (with FALSE in the cell because they are irrellevant). What I want to do is automatically hide any rows with 'false' in it. I have created in Microsoft Visual the following Macro:

Sub HideRows()

If Sheets("Sheet2").Range("A13").Value = False Then
Sheets("Sheet2").Range("A13").Select
Selection.EntireRow.Hidden = True
End If

End Sub

This works for what I want it to do, however is specific to one row (ie a13). When I want it to remove all false cells the macro wont work. I have tried the range "A:A", "A,A" and several more but to no avail. Can anybody help.
Many Thanks
Jonathan
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Fmedia

New Member
Joined
Oct 10, 2006
Messages
7
Hi,
Thanks for responding.

yes, col A is the master field so 'false' will always return in here if not relevant.

Jonathan
 

SteveO59L

Well-known Member
Joined
Apr 21, 2004
Messages
7,899
Dim c As Range, rng
Set rng = Range("a1:a30")
For Each c In rng
If c.Value = "False" Then
c.EntireRow.Hidden = True
End If
Next c
 

Forum statistics

Threads
1,170,949
Messages
5,872,891
Members
432,953
Latest member
Il Prete

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
Top