Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Step_Thru_SlicerItems2()
- Dim slItem As SlicerItem
- Dim i As Long
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, 367.8, 3.6, 159, 54).Select
- With Selection.ShapeRange.Fill
- .Visible = msoTrue
- .ForeColor.RGB = RGB(255, 255, 255)
- .Transparency = 0
- .Solid
- End With
- Selection.ShapeRange.Line.Visible = msoFalse
- Selection.ShapeRange.Name = "WhiteSquare"
- Selection.Name = "WhiteSquare"
- Application.ScreenUpdating = False
- With ActiveWorkbook.SlicerCaches("Slicer_Student")
- '--deselect all items except the first
- .SlicerItems(1).Selected = True
- For Each slItem In .VisibleSlicerItems
- If slItem.Name <> .SlicerItems(1).Name Then _
- slItem.Selected = False
- Next slItem
- Call MyFunction(1)
- '--step through each item and run custom function
- For i = 2 To .SlicerItems.Count
- .SlicerItems(i).Selected = True
- .SlicerItems(i - 1).Selected = False
- Call MyFunction(i)
- Next i
- End With
- Application.ScreenUpdating = True
- ActiveSheet.Shapes.Range(Array("WhiteSquare")).Select
- Selection.Delete
- End Sub
- Function MyFunction(lItem As Long)
- Dim wsPivot As Worksheet
- Dim lNextRow As Long
- Const lRowsPerPic As Long = 11
- lNextRow = (lItem - 1) * lRowsPerPic + 1
- Sheets("SemReport").PrintOut Copies:=1, Collate:=True, ignorePrintAreas:=False
- End Function
Add Comment
Please, Sign In to add comment