View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
andym andym is offline
external usenet poster
 
Posts: 12
Default sensitive button


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


This is my version...

Create a button called cmd_Hide (or whatever). Set initial caption property
as "Hide".

I have done this to hide column "D", but of course this can be changed to
another or a range...

This is my procedure...

Sub cmd_Hide_Click()

If cmd_Hide.Caption = "Hide" Then
Columns("D:D").Hidden = True
cmd_Hide.Caption = "Unhide"
Else
Columns("D:D").Hidden = False
cmd_Hide.Caption = "Hide"
End If

End Sub

This worked fine in my test. There could be a better / another way .. but
this works :)

Regards,

andy m