Gringoire
Board Regular
- Joined
- Nov 18, 2016
- Messages
- 71
- Office Version
- 365
- Platform
- Windows
Hello friends,
I wrote a simple sub to place my shapes at the right position in my sheet but I have some issue with slider positioning:
The instructions sl.Shape.Top = cTop and sl.Shape.Left = cLeft raise a Run Time error ' -21470224809(80070057) The specified value is out of range."
I also tried to assign the Top and Left values directly to sl (the Slicer) with no success (run time error 5).
The property .top and .Left works with all the oter shapes (combobox, buttons, checkbox, etc.) but not with Slicer shapes....
Can you please explain me where I'm doing wrong?
I wrote a simple sub to place my shapes at the right position in my sheet but I have some issue with slider positioning:
The instructions sl.Shape.Top = cTop and sl.Shape.Left = cLeft raise a Run Time error ' -21470224809(80070057) The specified value is out of range."
I also tried to assign the Top and Left values directly to sl (the Slicer) with no success (run time error 5).
The property .top and .Left works with all the oter shapes (combobox, buttons, checkbox, etc.) but not with Slicer shapes....
Can you please explain me where I'm doing wrong?
VBA Code:
Sub placeShapes()
'=============================================
'Place the shapes into the right positions
'=============================================
Dim cTop As Double, sp As Double, cLeft As Double
cTop = 31: sp = 10
With shAnalisi 'This is the sheet codename
Call BtnResize(.cmbPivot, 8, cTop, .Columns(1).Width, 19, 215) 'combo box
Call BtnResize(.btnAdvf, 8, cTop, .cmbPivot.Left + .cmbPivot.Width + sp, 18, 97)
cLeft = .btnAdvf.Left + .btnAdvf.Width + sp
Dim slC As SlicerCache, sl As slicer
For Each slC In ActiveWorkbook.SlicerCaches
For Each sl In slC.Slicers
sl.Shape.Top = cTop
sl.Shape.Left = cLeft
cLeft = sl.Left + sl.Width + sp
Next
Next
End With
End Sub