Thread: Toggle Button
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
William William is offline
external usenet poster
 
Posts: 119
Default Toggle Button

Well I was definitely a little off. Thanks for your help Rick!!!

"Rick Rothstein" wrote:

Try it something like this...

Private Sub ToggleButton1_Click()
With ActiveSheet
If ToggleButton1.Value Then
.Columns("C:E").EntireColumn.Hidden = True
.Columns("F:F").Borders(xlEdgeLeft).Weight = xlThin
Else
.Columns("C:E").Hidden = False
.Columns("F:F").Borders(xlEdgeLeft).LineStyle = xlNone
End If
End With
End Sub

Although it is possible that I have the Then and Else block statements
reversed in location.

--
Rick (MVP - Excel)


"William" wrote in message
...
I have a toggle button that I would like to unhide some columns and remove
a
border line on the first click. On the second click, I would like for it
to
rehide the same columns and put the line back. I thought that I had this
figured out. Please help. This is what I have so far:

Private Sub ToggleButton1_Click()
ActiveSheet.Range(€śC:E€ť).EntireColumn.Hidden=F alse
ActiveSheet.Range("F:F").Borders(xlEdgeLeft).LineS tyle = xlNone
Not.ActiveSheet.Range€śC:E€ť).EntireColumn.Hidde n=True
Not.ActiveSheet.Range("F:F").Borders(xlEdgeLeft).W eight = xlThin
End Sub