Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Second Click on Control Button

Greetings!

I made a control button that will unhide a column in a certain range using:

Private Sub CommandButton2_Click()
Columns("B").Select
Selection.EntireColumn.Hidden = False
Range("B1").Select
End Sub

How can I modify this to re-hide the column on the second click, or if it
his already unhidden?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Second Click on Control Button

Private Sub CommandButton2_Click()
With Columns(2)
.EntireColumn.Hidden = Not .EntireColumn.Hidden
End With
Range("B1").Select
End Sub


Gord Dibben MS Excel MVP

On Tue, 1 Aug 2006 14:30:02 -0700, iamjbunni
wrote:

Greetings!

I made a control button that will unhide a column in a certain range using:

Private Sub CommandButton2_Click()
Columns("B").Select
Selection.EntireColumn.Hidden = False
Range("B1").Select
End Sub

How can I modify this to re-hide the column on the second click, or if it
his already unhidden?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Second Click on Control Button

Private Sub CommandButton2_Click()
With Columns("B")
.Hidden = Not .Hidden
End With
Range("B1").Select
End Sub


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"iamjbunni" wrote in message
...
Greetings!

I made a control button that will unhide a column in a certain range

using:

Private Sub CommandButton2_Click()
Columns("B").Select
Selection.EntireColumn.Hidden = False
Range("B1").Select
End Sub

How can I modify this to re-hide the column on the second click, or if it
his already unhidden?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Second Click on Control Button

Give this a try...

Private Sub CommandButton2_Click()
With Columns("D")
If .Hidden = True Then
CommandButton2.Caption = "Hide Column"
.Hidden = False
Else
CommandButton2.Caption = "Un-Hide Column"
.Hidden = True
End If
End With
End Sub
--
HTH...

Jim Thomlinson


"iamjbunni" wrote:

Greetings!

I made a control button that will unhide a column in a certain range using:

Private Sub CommandButton2_Click()
Columns("B").Select
Selection.EntireColumn.Hidden = False
Range("B1").Select
End Sub

How can I modify this to re-hide the column on the second click, or if it
his already unhidden?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Second Click on Control Button

Thank you!

"Gord Dibben" wrote:

Private Sub CommandButton2_Click()
With Columns(2)
.EntireColumn.Hidden = Not .EntireColumn.Hidden
End With
Range("B1").Select
End Sub


Gord Dibben MS Excel MVP

On Tue, 1 Aug 2006 14:30:02 -0700, iamjbunni
wrote:

Greetings!

I made a control button that will unhide a column in a certain range using:

Private Sub CommandButton2_Click()
Columns("B").Select
Selection.EntireColumn.Hidden = False
Range("B1").Select
End Sub

How can I modify this to re-hide the column on the second click, or if it
his already unhidden?



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
right-click on a control button and view code does nothing Kate Excel Worksheet Functions 11 November 16th 07 12:24 AM
Add control to right click menu when something is on the clipboard Sean Excel Programming 2 March 27th 06 09:32 AM
Why does the click event get control? Lee Hunter Excel Programming 1 October 31st 05 06:26 PM
Create floating button based on button click in menu ExcelMonkey Excel Programming 2 October 12th 05 06:43 PM
Click on Image Control disables it Wexler Excel Programming 0 October 7th 03 05:35 PM


All times are GMT +1. The time now is 04:16 AM.

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"