Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Toggling Button Labels Between Expand/Collapse

Hi. I'm new to VBA and stuck on what I thought would be a simple task.
I have a worksheet with several large sections arranged vertically.
Each section has a header with a button control next to it. I'd like
to have the user click the button to toggle between hiding/showing
several rows below it and at the same time toggle the text label of the
button between Expand and Collapse.

I found the button property I need to toggle
(Selection.Characters.Text), but I'm not sure of the best way to
declare some sort of "binary toggle" variable and then step back and
forth between the two.

Any advice? Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Toggling Button Labels Between Expand/Collapse

How about:
If CommandButton1.Caption = "Expand" then
Range(xx).Show
CommandButton1.Caption = "Collapse"
else
Range(xx).Hide
CommandButton1.Caption = "Expand"
End If

thomas wrote:
Hi. I'm new to VBA and stuck on what I thought would be a simple task.
I have a worksheet with several large sections arranged vertically.
Each section has a header with a button control next to it. I'd like
to have the user click the button to toggle between hiding/showing
several rows below it and at the same time toggle the text label of the
button between Expand and Collapse.
I found the button property I need to toggle
(Selection.Characters.Text), but I'm not sure of the best way to
declare some sort of "binary toggle" variable and then step back and
forth between the two.



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
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
Expand/Collapse Rows [email protected] Excel Worksheet Functions 0 May 18th 06 09:23 AM
expand and collapse button with subtotals TUNGANA KURMA RAJU Excel Discussion (Misc queries) 1 May 6th 06 01:18 PM
Expand and Collapse Columns JVICO New Users to Excel 1 April 21st 06 02:13 AM
HOW CAN I COLLAPSE AND EXPAND COLUMS JVICO Excel Discussion (Misc queries) 1 April 21st 06 02:04 AM
expand/collapse row button caii Excel Discussion (Misc queries) 3 October 26th 05 09:44 AM


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