cagataybaser
New member
- Joined
- Aug 14, 2014
- Messages
- 13
- Reaction score
- 0
- Points
- 0
I add two checkBoxes in the ribbon using xml with that code (with Custom UI Editor for Microsoft Office) <checkBox id ="F16" label="F16" onAction="Show_Column" /> <checkBox id ="F20" label="F20" onAction="Show_Column" /> That execute this vba code : Sub Show_Column(control As IRibbonControl, pressed As Boolean) Dim strn As String ActiveSheet.Cells.EntireColumn.Hidden = False Range("B:ZZ").EntireColumn.Hidden = True strn = control.id Search strn, pressed End If End Sub Sub Search(fnd As String, pressed As Boolean) If pressed = True Then Dim firstfound As String Dim foundcell As Range,rng As Range Dim myRange As Range, lastcell As Range Set myRange = ActiveSheet.UsedRange Set lastcell = myRange.Cells(myRange.Cells.Count) Set foundcell = myRange.Find(what:=fnd, after:=lastcell) If Not foundcell Is Nothing Then firstfound = foundcell.Address End If Set rng = foundcell Do Until foundcell Is Nothing Set foundcell = myRange.FindNext(after:=foundcell) Set rng = Union(rng, foundcell) If foundcell.Address = firstfound Then Exit Do Loop rng.EntireColumn.Hidden = False Else Exit Sub End If As you can see it searches the id of the checkbox and hide other datas. What I need to do is to make this checkBoxes to work together to show all checked datas.Any help would be greatly appreciated. |
Last edited: