VBA Macro: Select first cell of filtered table to use as filename to save and email PDF

testarossa933

New Member
Joined
Apr 6, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Greetings,

My filtered table is as follows, with conditional formatting to highlight cells that show value below 40:

EmployeeFirst NameEmailAddress02-Jan09-Jan16-Jan23-Jan30-Jan06-Feb13-Feb20-Feb27-Feb06-Mar13-Mar20-Mar27-Mar02-Apr
Test NameTesttest@name.com
40.00​
40.00​
40.00​
40.00​
41.00​
40.00​
40.00​
40.00​
40.00​
40.00​
0.00​
0.00​
0.00​
0.00​

I would like to email this filtered table, either as PDF or in the body of the email with formatting preserved if possible, going through a loop in a slicer which filters the employees results. What would be the best way to achieve this?

I have the slicer loop figured out with the following code:
VBA Code:
Set SC = ActiveWorkbook.SlicerCaches("Slicer_Employee") 'Add slicer name between " "
Set SL = SC.SlicerCacheLevels(1)

'c(ounter) is set to 1, ready to begin
C = 1


'Repeat the a loop until number of prints exceeds number of items in slicer
Do While C <= SC.SlicerCacheLevels.Item.Count + 1

'This makes sure that SI is the correct slicer. Needed for correct file name.
    For Each SI In SL.SlicerItems
        If SI.Selected = True Then
        SlicerverdiIndex = C
    Exit For
        End If
    Next SI

Thanks.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,055
Latest member
excelhelp12345

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