goss
Active Member
- Joined
- Feb 2, 2004
- Messages
- 372
Hi all,
Using Excel 2010
I am trying to add a slicer dynamically.
User chooses from another slicer, Pivot Table is updated, should delete and recreate another slicer
Works well excel the left position of the slicer
I have noted to position at 1202.75. However it is consistently positioned at 1207.25
Any thoughts on why this may be?
thx
w
Code to test Slicer:
Output:
Using Excel 2010
I am trying to add a slicer dynamically.
User chooses from another slicer, Pivot Table is updated, should delete and recreate another slicer
Works well excel the left position of the slicer
I have noted to position at 1202.75. However it is consistently positioned at 1207.25
Any thoughts on why this may be?
thx
w
Code:
'Add slicer cache
With wb
.SlicerCaches.Add(wsPT.PivotTables("PivotTable1"), _
"[dimTable].[Field]").Slicers.Add ws, _
"[dimTable].[Field].[Field]", "Field", "Field", 481.75, _
1202.75, 158.5001, 198.75
End With
Code to test Slicer:
Code:
Sub SlicerProperties()
Dim wb As Workbook
Dim ws As Worksheet
Dim sh As Shape
Set wb = ThisWorkbook
Set ws = wb.Worksheets("Scorecard")
With ws
For Each sh In .Shapes
If sh.Type = msoSlicer Then
Debug.Print "Name " & sh.Name
Debug.Print "Type " & sh.Type
Debug.Print "Width " & sh.Width
Debug.Print "Top " & sh.Top
Debug.Print "Left " & sh.Left
Debug.Print "Height " & sh.Height
Debug.Print "-----------------------------------"
End If
Next sh
End With
Set ws = Nothing
Set wb = Nothing
End Sub
Output:
Name SlicerName
Type 25
Width 159.2501
Top 481.75
Left 1207.25
Height 198.75
-----------------------------------