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

I want to create 2 toggle buttons.

1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it.
When it is clicked again the "X" goes away and the cell is empty.

2.) Toggle button 2: I want this toggle button to clear out certain cells
(a range) and when it is clicked again to put sample data in that range.

Sounds simple...but I'm having trouble figuring out how to do it.

Thanks for your help!

Jonco


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Toggle Button help

I put two toggle buttons from the Control toolbox toolbar on a worksheet.

I put this in that worksheet's code module:


jonco wrote:

I want to create 2 toggle buttons.

1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it.
When it is clicked again the "X" goes away and the cell is empty.

2.) Toggle button 2: I want this toggle button to clear out certain cells
(a range) and when it is clicked again to put sample data in that range.

Sounds simple...but I'm having trouble figuring out how to do it.

Thanks for your help!

Jonco


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Toggle Button help

I put two toggle buttons from the Control toolbox toolbar on a worksheet.

I put this in that worksheet's code module:

Option Explicit
Private Sub ToggleButton1_Click()
If Me.ToggleButton1.Value = True Then
Me.Range("c33").ClearContents
Else
Me.Range("C33").Value = "X"
End If
End Sub

Private Sub ToggleButton2_Click()
Dim myRng As Range
Dim myArea As Range

Set myRng = Me.Range("a3:b9,c12:d18,f19,g1:h3")

If Me.ToggleButton2.Value = True Then
myRng.ClearContents
Else
For Each myArea In myRng.Areas
With myArea
.Formula = "=rand()"
.Value = .Value
End With
Next myArea
End If
End Sub


jonco wrote:

I want to create 2 toggle buttons.

1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it.
When it is clicked again the "X" goes away and the cell is empty.

2.) Toggle button 2: I want this toggle button to clear out certain cells
(a range) and when it is clicked again to put sample data in that range.

Sounds simple...but I'm having trouble figuring out how to do it.

Thanks for your help!

Jonco


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Toggle Button help

Thanks. I'll give that a try.

Jonco

"jonco" wrote in message
t...
I want to create 2 toggle buttons.

1.) Toggle button 1: When it is clicked cell C33 contains an "X" in it.
When it is clicked again the "X" goes away and the cell is empty.

2.) Toggle button 2: I want this toggle button to clear out certain
cells (a range) and when it is clicked again to put sample data in that
range.

Sounds simple...but I'm having trouble figuring out how to do it.

Thanks for your help!

Jonco



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
Need help using a toggle button tanktata[_6_] Excel Programming 5 June 28th 06 08:01 PM
Toggle Button NavEx Excel Worksheet Functions 1 May 23rd 06 02:40 AM
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


All times are GMT +1. The time now is 07:56 AM.

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"