View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default sensitive button

Hi Thomas,

Assume your button to be from the control toolbox and that the button is
named CommandButton1, try:

Private Sub CommandButton2_Click()
Dim rng As Range
Set rng = Me.Columns("A:A") '<===CHANGE
rng.Hidden = Not rng.Hidden
With Me.CommandButton2
.Caption = IIf(rng.Hidden, "Unhide", "Hide")
End With
End Sub

Change Columns("A:A") to reflect the required column.
---
Regards,
Norman



"Jonsson" wrote in message
...

Hi,

I have a format button which I want to use as a button for hide and
unhide a column. I,m looking for a way to :

1:st click =hide column , change text button to "unhide"
2:nd click=unhide column , change text in button to "hide"

Any ideas?

Thanks in advance!

//Thomas


--
Jonsson
------------------------------------------------------------------------
Jonsson's Profile:
http://www.excelforum.com/member.php...fo&userid=5472
View this thread: http://www.excelforum.com/showthread...hreadid=268412