Hiden/Unhiding specific rows within tables without filter on headers (VBA)

Djani

Board Regular
Joined
Aug 26, 2015
Messages
61
Hoi allemaal,

Ik heb een x aantal tabellen in een worksheet die dezelfde structuur/format hebben. Hierbij vergelijk ik data van de huidige maand met de vorige maand. Hierdoor is het mogelijk dat de data - zoals weergeven in de tabel - veranderd. Iedere maand kan de positie van de modellen BINNEN de tabel veranderen, dus als bijv. rij 20 deze maand wordt gehided, dan hoeft dat niet zo te zijn in de volgende vergelijking.

Ik ga deze tabellen in PowerPoint plaatsen via "Paste Link" zodat de tabellen daarin automatisch geupdatet worden. Hierdoor is het plaatsen van een filter geen optie. Is het mogelijk om m.b.v. een VBA script de rijen te hiden/unhiden in de tabellen (niet de hele sheet)? Ik zat te denken aan 1 "CommandButton" met als tekst "Hide Rows" en "Unhide Rows".

Hello everyone,

I have got an x amount of tables in a worksheet that alle have the same structure/format. I make a comparison of the data of the current month with the last month. This makes the 'position' of the data within the table 'unstable'. E.g. a car is shown in row 22, but the next month this row can be empty, but row 21 can be filled in with data for example.

I am going to link these tables to PowerPoint via "Paste Link" so it gets automatically updatet with the desired format. This makes the 'autofilter' not an option. Is it possible to have a VBA script that hides/unhides rows WITHIN the tables (and not the rows inbetween the tables)? I was thinking on creating a "CommandButton" with the text "Hide rows" and "Unhide Rows" whenever someone clicks on it.

Code:
Private Sub CommandButton4_Click()
If CommandButton4.Caption = "Hide Rows" Then
 
    CommandButton4.Caption = "Show Rows"

Else
  
  CommandButton4.Caption = "Hide Rows"
End If

End Sub

Down below you will see a picture with 2 tables. The upper one is the current situation, and the bottom table is how I want it to be after clicking/running the macro.

21n4ab9.png


If there is a value within the tables in column F, then I want the row to be hidden. To give you exact information: the range of the table is from "F6" to "L17".

Yours sincerely,

Djani Sadloe
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,491
Messages
6,125,110
Members
449,205
Latest member
ralemanygarcia

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