Excel VBA Update Code to where my slicers are above frozen pane C8

lennyt00

New Member
Joined
Apr 29, 2023
Messages
1
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Update the code below to where whenever I freeze the panes at c8 the slicers don't cover the data there. I need the slicers to be above cell c8 and move along whenever I scroll the worksheet:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)

Dim ShF As Shape

Dim ShM As Shape

'specify a slicer

Application.ScreenUpdating = False

Set ShA = ActiveSheet.Shapes("Region 1")

Set ShB = ActiveSheet.Shapes("Region 2 12")

Set ShC = ActiveSheet.Shapes("SCBM 51")

Set ShD = ActiveSheet.Shapes("CBT 47")

Set ShE = ActiveSheet.Shapes("Plan Owner 6")

Set ShF = ActiveSheet.Shapes("Month/Quarter 42")

Set ShG = ActiveSheet.Shapes("Month/Quarter2 1")

Set ShH = ActiveSheet.Shapes("YTD/YTG 4")

Set ShI = ActiveSheet.Shapes("BU New 46")

Set ShJ = ActiveSheet.Shapes("Category 45")

Set ShK = ActiveSheet.Shapes("Category Grouping 4")



'change position of the slicer

With Windows(1).VisibleRange.Cells(1, 1)



ShA.Top = .Top + 12.5

ShA.Left = .Left + 10



ShB.Top = .Top + 90

ShB.Left = .Left + 10



ShC.Top = .Top + 12.5

ShC.Left = .Left + 220



ShD.Top = .Top + 12.5

ShD.Left = .Left + 373



ShE.Top = .Top + 12.5

ShE.Left = .Left + 495



ShF.Top = .Top + 12.5

ShF.Left = .Left + 753



ShG.Top = .Top + 112

ShG.Left = .Left + 753



ShH.Top = .Top + 112

ShH.Left = .Left + 917



ShI.Top = .Top + 12.5

ShI.Left = .Left + 917



ShJ.Top = .Top + 12.5

ShJ.Left = .Left + 1030



ShK.Top = .Top + 12.5

ShK.Left = .Left + 1385



End With

Application.ScreenUpdating = True

End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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