I cannot understand why I am getting an error on this; when the code was inside the ComboBox all worked fine.
I am trying to break the looping back nature. When my code for the ChangePCtr() was part of the Combobox code, everything run fine. Except it would re-loop and clear out the Linked Cell.
Here is the code
Private Sub ComboBox1_Change()
vAreaNew = Range("AreaNew").Value
vAreaOld = Range("AreaOld").Value
If vAreaNew <> vAreaOld Then
With ActiveWorkbook.SlicerCaches("Slicer_Area")
.SlicerItems(vAreaNew).Selected = True
.SlicerItems(vAreaOld).Selected = False
End With
ChangePctr
End If
End Sub
Sub ChangePctr()
Sheets("Select").Select
vOld = Range("SPCTR").Value
k = ComboBox2.ListCount
ActiveWorkbook.SlicerCaches("Slicer_PctrName").ClearManualFilter
ActiveWorkbook.SlicerCaches("Slicer_Branch").ClearManualFilter
Dim cache As Excel.SlicerCache
Set cache = ActiveWorkbook.SlicerCaches("Slicer_PctrName")
ComboBox2.Clear
k = ComboBox2.ListCount
Dim sItem As Excel.SlicerItem
For Each sItem In cache.VisibleSlicerItems
If sItem.HasData = True Then ComboBox2.AddItem sItem.Name
k = ComboBox2.ListCount
Next
k = ComboBox2.ListCount
MsgBox (k)
Range("SPCTR").Value = vOld
End Sub
Bookmarks