Autohide rows and colums based on cell value and column and row header

BSAGAERT

New Member
Joined
Sep 26, 2013
Messages
10
I have a problem wich is similar to some already posted, but yet different and more complicated.

I want to limit the number of rows and columns based on cell content in the first row and the first column.
What I mean is, based on the value X in A1, I want to see the columns that have X in the first row of a the range "H:AX", and the rows that have X in the first column in the range "5:2000"
If no selection is made, I want to see all rows and all columns.
Is there a <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VbA</acronym> solution for this case as well?
Excel 2013
Windows 8
Reposted under
http://www.mrexcel.com/forum/excel-...olums-based-cell-value-column-row-header.html since similar, yet different
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try this in the module for the worksheet:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim i As Long
    If Target.Address <> "$A$1" Then Exit Sub
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    With Range("H4:AX650")
        .EntireColumn.Hidden = False
        .EntireRow.Hidden = False
        For i = 2 To .Rows.Count
            With .Cells(i, 1)
                .EntireRow.Hidden = .Value <> Target.Value
            End With
        Next i
        For i = 2 To .Columns.Count
            With .Cells(1, i)
                .EntireColumn.Hidden = .Value <> Target.Value
            End With
        Next i
    End With
    Application.ScreenUpdating = True
    Application.EnableEvents = True
End Sub
 
Upvote 0
Thanks for the fast response! However it is not working. On every selection, it hides the same rows and columns and does not change upon change in $A$1.
 
Upvote 0
Just copy a small but representative sample of your data and paste it into a reply. And give an example of what you are putting in A1.
 
Upvote 0
ManagementManagementManagementManagementManagementManagementManagementManagementManagementManagement
Medewerker 1Medewerker 2Medewerker 3Medewerker 4Medewerker 5
AfdelingTaakOpleidingOpleiding nummerType opleidingFrequentieActieve versieVersie datumStatus/ versieDatumStatus/ versieDatumStatus/ versieDatumStatus/ versieDatumStatus/ versie
ManagementDocumentbeheerbeheer van agreements en contracten101xxxxxx
ManagementKwaliteitqualification & approval of suppliers1040417/06/2013xxxxx
ManagementKwaliteituitvoeren van een uitgebreid onderzoek1050xxxxx
ManagementKwaliteitbeheer van CAPA's1051xxxxx
ManagementKwaliteitQuality risk management1060125/04/2013xxxxx
ManagementKwaliteitFacility tour1090128/05/2013xxxxx
ManagementKwaliteitTerugroepen van goederen van de markt1110312/08/2013xxxxx
ManagementKwaliteitManagement review114017/08/2013xxxxx
ManagementKwaliteitInterne audit115052/08/2013xxxxx
ManagementKwaliteitExterne kwaliteitsaudits115147/08/2013xxxxx
ManagementKwaliteitTekortkoming onderzoek1160xxxxx
ManagementKwaliteitAPR 24/03/2016xxxxx
ManagementKwaliteitaankoop van producten6000xxxxx
ManagementKwaliteitbeheer van toestellen5030313/08/2012xxxxx

<colgroup><col><col><col><col><col><col><col><col><col><col><col span="7"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,088
Messages
6,128,744
Members
449,466
Latest member
Peter Juhnke

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