Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Toggle Button

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Toggle Button

Private Sub ToggleButton1_Click()
If ToggleButton1.Value = False Then
Me.Range("C:E").EntireColumn.Hidden = False
Me.Range("F:F").Borders(xlEdgeLeft).LineStyle = xlNone
Else
Me.Range("C:E").EntireColumn.Hidden = True
Me.Range("F:F").Borders(xlEdgeLeft).Weight = xlThin
End If
End Sub
--
Jim Cone
Portland, Oregon USA



"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Toggle Button

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Toggle Button

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

"Jim Cone" wrote:

Private Sub ToggleButton1_Click()
If ToggleButton1.Value = False Then
Me.Range("C:E").EntireColumn.Hidden = False
Me.Range("F:F").Borders(xlEdgeLeft).LineStyle = xlNone
Else
Me.Range("C:E").EntireColumn.Hidden = True
Me.Range("F:F").Borders(xlEdgeLeft).Weight = xlThin
End If
End Sub
--
Jim Cone
Portland, Oregon USA



"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


  #5   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle button keithl816 Excel Discussion (Misc queries) 2 November 21st 05 09:16 PM
Toggle Button Dave_2k5 Excel Discussion (Misc queries) 2 September 1st 05 11:27 AM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Toggle Button Ben E[_2_] Excel Programming 1 October 29th 03 04:42 PM


All times are GMT +1. The time now is 05:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"