菜鸟求解EXCEL代码
以下是网页找到的excel切片器跟随滚动条定位代码
求解怎么才能作用于工作簿中的某一个工作表
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim ShF As Shape
Dim ShM As Shape
Dim ShN As Shape
Dim ShO As Shape
'specify a slicer
Application.ScreenUpdating = False
Set ShF = ActiveSheet.Shapes("类别 2")
Set ShM = ActiveSheet.Shapes("科目 2")
Set ShN = ActiveSheet.Shapes("部属 1")
Set ShO = ActiveSheet.Shapes("经办人")
'change position of the slicer
With Windows(1).VisibleRange.Cells(1, 1)
ShF.Top = .Top + 30
ShF.Left = .Left + 773
ShM.Top = .Top + 30
ShM.Left = .Left + 850
ShN.Top = .Top + 30
ShN.Left = .Left + 928
ShO.Top = .Top + 30
ShO.Left = .Left + 1006
End With
Application.ScreenUpdating = True
End Sub