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


Hi,

I have a format button which I want to use as a button for hide an
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!

//Thoma

--
Jonsso
-----------------------------------------------------------------------
Jonsson's Profile: http://www.excelforum.com/member.php...nfo&userid=547
View this thread: http://www.excelforum.com/showthread.php?threadid=26841

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



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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default sensitive button

Hi Thomas,

Private Sub CommandButton2_Click()


Change 2 to 1, of course!

---
Regards,
Norman



"Norman Jones" wrote in message
...
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





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
HELP!!! TIME SENSITIVE Walt Excel Worksheet Functions 5 September 22nd 08 07:25 PM
Cap Sensitive Countif Tod H Excel Worksheet Functions 2 September 10th 08 09:09 PM
Case sensitive filtering kk122 Excel Discussion (Misc queries) 3 May 15th 06 11:18 PM
Case Sensitive w/ IF jeffP Excel Worksheet Functions 11 February 6th 06 01:16 AM
context sensitive help Malcolm Excel Programming 0 November 19th 03 02:00 PM


All times are GMT +1. The time now is 12:50 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"