Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default 1 Userbutton to perform alternating functions

Hi

I'm wondering how I do this:

I want one userbutton on a spreadsheet where, if columns D - H are
hidden, the button unhides them, or if they are visible it hides them.

Does anyone have any advice, please?

Thanks in advance

Steve
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default 1 Userbutton to perform alternating functions

Insert this line in the button's code module:
Columns("D:H").EntireColumn.Hidden = Not Columns("D:H").EntireColumn.Hidden

Regards,
Stefi

€žSteve€ť ezt Ă*rta:

Hi

I'm wondering how I do this:

I want one userbutton on a spreadsheet where, if columns D - H are
hidden, the button unhides them, or if they are visible it hides them.

Does anyone have any advice, please?

Thanks in advance

Steve

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default 1 Userbutton to perform alternating functions

On Oct 21, 8:37*pm, Steve wrote:
Hi

I'm wondering how I do this:

I want one userbutton on a spreadsheet where, if columns D - H are
hidden, the button unhides them, or if they are visible it hides them.

Does anyone have any advice, please?

Thanks in advance

Steve


ActiveSheet.Range("D:H").EntireColumn.Hidden = Not
(ActiveSheet.Range("D:H").EntireColumn.Hidden)

Ken Johnson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default 1 Userbutton to perform alternating functions

On Oct 21, 8:54*pm, Ken Johnson wrote:
On Oct 21, 8:37*pm, Steve wrote:

Hi


I'm wondering how I do this:


I want one userbutton on a spreadsheet where, if columns D - H are
hidden, the button unhides them, or if they are visible it hides them.


Does anyone have any advice, please?


Thanks in advance


Steve


ActiveSheet.Range("D:H").EntireColumn.Hidden = Not
(ActiveSheet.Range("D:H").EntireColumn.Hidden)

Ken Johnson


But this is neater...

With ActiveSheet.Columns("D:H")
.Hidden = Not .Hidden
End With

Ken Johnson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 1 Userbutton to perform alternating functions

Steve,

You could also change the button caption

Private Sub CommandButton1_Click()
With ActiveSheet.Columns("D:H")
.Hidden = Not .Hidden
If .Hidden Then
CommandButton1.Caption = "Show"
Else
CommandButton1.Caption = "Hide"
End If
End With
End Sub

Mike

"Steve" wrote:

Hi

I'm wondering how I do this:

I want one userbutton on a spreadsheet where, if columns D - H are
hidden, the button unhides them, or if they are visible it hides them.

Does anyone have any advice, please?

Thanks in advance

Steve

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
How to perform caculations using database functions in this case [email protected] Excel Discussion (Misc queries) 2 February 8th 08 01:04 PM
Using a formula to perform multiple functions. elusiverunner Excel Discussion (Misc queries) 3 October 1st 06 11:31 PM
Can you perform Math functions with ActiveX Checkbox controls? ForTor69 Excel Worksheet Functions 1 May 18th 06 05:23 PM
Are there functions that perform robust statistics in Excel? froot_broot Excel Worksheet Functions 0 August 30th 05 10:18 PM
Perform functions on the result of adding two columns Tim Archer Excel Worksheet Functions 2 February 2nd 05 03:25 PM


All times are GMT +1. The time now is 07:39 PM.

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

About Us

"It's about Microsoft Excel"