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

I would like to use a toggle button to hide and unhide several columns and
rows.
The first thing I did was to create 2 macros 1 to hide and other to unhide.
But now I would like to link those macros in a toggle button. I have tried
but no results. Is any idea around? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default toggle button in excel

you can hide or show columns & rows by setting Hidden property True or False
If you want to toggle it, you need to use Not operator as following:
rng.EntireRow.Hidden = Not rng.EntireRow.Hidden
rng.EntireColumn.Hidden = Not rng.EntireColumn.Hidden

where rng is a Range object variable.
--
msn
---------------------------------------------
the best time to plant a tree was twenty years ago.
the second best time, is today - Chinese proverb



"lharthur" wrote:

I would like to use a toggle button to hide and unhide several columns and
rows.
The first thing I did was to create 2 macros 1 to hide and other to unhide.
But now I would like to link those macros in a toggle button. I have tried
but no results. Is any idea around? Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default toggle button in excel

See code below..

Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide" Then
Columns("G:G").Select
Selection.EntireColumn.Hidden = True
CommandButton1.Caption = "UnHide"
Else
Columns("G:G").Select
Selection.EntireColumn.Hidden = False
CommandButton1.Caption = "Hide"
End If
End Sub
------------------------------------------------------------------

"lharthur" wrote:

I would like to use a toggle button to hide and unhide several columns and
rows.
The first thing I did was to create 2 macros 1 to hide and other to unhide.
But now I would like to link those macros in a toggle button. I have tried
but no results. Is any idea around? Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default toggle button in excel

Thanks for your help Timebird I appreciate it....
This helps me with the columns (consecutive data), but I have non
consecutive rows. I have data on every row, some of those rows (non
consecutive) have data grouped (it have the cross icon on the upperleft
corner to hide & unhide) What i'm trying to do is use a button instead of the
cross icon that appear when you group data with a row or column.
Suggestions? Thanks

"timebird" wrote:

you can hide or show columns & rows by setting Hidden property True or False
If you want to toggle it, you need to use Not operator as following:
rng.EntireRow.Hidden = Not rng.EntireRow.Hidden
rng.EntireColumn.Hidden = Not rng.EntireColumn.Hidden

where rng is a Range object variable.
--
msn
---------------------------------------------
the best time to plant a tree was twenty years ago.
the second best time, is today - Chinese proverb



"lharthur" wrote:

I would like to use a toggle button to hide and unhide several columns and
rows.
The first thing I did was to create 2 macros 1 to hide and other to unhide.
But now I would like to link those macros in a toggle button. I have tried
but no results. Is any idea around? Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default toggle button in excel

Thanks Himani... it helps me on how to program the button.. But I do not
have consecutive rows data that I need to hide.. it represents my biggest
problem...
Because the sheet is being updated by adding information when I use the
upperleft 1,2 button it will hide or unhide all the information.

"Himani" wrote:

See code below..

Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide" Then
Columns("G:G").Select
Selection.EntireColumn.Hidden = True
CommandButton1.Caption = "UnHide"
Else
Columns("G:G").Select
Selection.EntireColumn.Hidden = False
CommandButton1.Caption = "Hide"
End If
End Sub
------------------------------------------------------------------

"lharthur" wrote:

I would like to use a toggle button to hide and unhide several columns and
rows.
The first thing I did was to create 2 macros 1 to hide and other to unhide.
But now I would like to link those macros in a toggle button. I have tried
but no results. Is any idea around? Thanks

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
Need to Use 1 Button to toggle On or Off Jim May Excel Discussion (Misc queries) 2 December 1st 07 08:01 PM
Toggle button keithl816 Excel Discussion (Misc queries) 2 November 21st 05 09:16 PM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Toggle betwen "editing" and "pushing" a button in excel brjohnson9 Excel Discussion (Misc queries) 1 December 9th 04 12:02 AM
Toggle Button Keri[_2_] Excel Programming 2 May 28th 04 04:58 PM


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