Is the current table row hidden by a filter?

Jephph

New Member
Joined
Mar 22, 2021
Messages
14
Office Version
  1. 365
Platform
  1. MacOS
I'm a new member but I've been finding answers to my questions often on this board. Thank you for all your help!

I have some VBA code that runs through each row of a table and copies the content of the row into a form then prints the form to PDF (thereby making a PDF for each record in the table. This works great if I want to print everything, but I also need to allow the user to filter and then just process what is visible.

I'd like to be able to assign the visibility of the current row to a boolean variable.

Here's a simplified version of my code. I feel like I'm so close yet so far away.

VBA Code:
Dim Vis as Boolean

For x = 1 to RowCount
    Vis = Worksheets("Control Center").ListObjects("AllData").Rows(x).SpecialCells(xlCellTypeVisible)
    If Vis = True Then
        'process the data and print'
    End If
Next
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Jephph

New Member
Joined
Mar 22, 2021
Messages
14
Office Version
  1. 365
Platform
  1. MacOS
I kept digging and found the answer to my own question. Here's my code...
VBA Code:
            'If RowHeight is 0 the row is hidden
            RHeight = Range("AllData[Last Name]").Cells(x).RowHeight
            
            If RHeight = 0 Then
                ToPrint = False
            Else
                ToPrint = True
            End If
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,129,566
Messages
5,637,085
Members
416,956
Latest member
mitzhaki

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