Hi to everyone!
I created 2 custom toggle buttons with Office RibbonX Editor. So my question is hot to connect them - i mean when i toggle one button - other one should be untoggled.
Here is some code from Office RibbonX Editor:
And here is my macros which are connected to buttons:
I created 2 custom toggle buttons with Office RibbonX Editor. So my question is hot to connect them - i mean when i toggle one button - other one should be untoggled.
Here is some code from Office RibbonX Editor:
Code:
<group id="customGroup4" label="Фільтрація за датою">
<toggleButton id="toggleButton1" label="На сьогодні" onAction = "show_today" imageMso = "QueryMakeTable" size = "large"/>
<separator id="separator1" />
<toggleButton id="toggleButton2" label="Цього тижня" onAction = "show_week" imageMso = "ChartEditDataSource" size = "large"/>
</group>
And here is my macros which are connected to buttons:
VBA Code:
Sub show_today(control As IRibbonControl, pressed As Boolean)
Dim lo As ListObject
Dim iCol As Long
Set lo = Sheets("Âõ³äí³").ListObjects("Òàáëèöà1")
iCol = lo.ListColumns("Âèêîíàòè äî").Index
If pressed = True Then
lo.AutoFilter.ShowAllData
With lo.Range
.AutoFilter Field:=iCol, _
Operator:=xlFilterDynamic, _
Criteria1:=xlFilterToday
End With
Else
lo.AutoFilter.ShowAllData
End If
End Sub
Sub show_week(control As IRibbonControl, pressed As Boolean)
Dim lo As ListObject
Dim iCol As Long
Set lo = Sheets("Âõ³äí³").ListObjects("Òàáëèöà1")
iCol = lo.ListColumns("Âèêîíàòè äî").Index
If pressed = True Then
lo.AutoFilter.ShowAllData
With lo.Range
.AutoFilter Field:=iCol, _
Operator:=xlFilterDynamic, _
Criteria1:=xlFilterThisWeek
End With
Else
lo.AutoFilter.ShowAllData
End If
End Sub