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

Hello,

I have multiple toggle buttons in an excel sheet that I need to generate
some behavior.

Although, they are lined up to perform identical tasks. For example,
Toggle Buttons 1, 2, 3, and 4 will modify cell A1, B1, C1 and D1.

Instead of having to create code for each individual togglebuttons, such as
sub togglebutton1_click()
----
end sub

togglebutton2_click()
----
end sub

is there any way that I can use the case function, for example

case is 1
----
case is 2
---
and so on?

Thank you in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default multiple toggle buttons

Actually, what I meant was...
can I use a for i=1 to 4

togglebutton(i)

cell(Ai)="Something"
next i

thanks

"Nelson" wrote:

Hello,

I have multiple toggle buttons in an excel sheet that I need to generate
some behavior.

Although, they are lined up to perform identical tasks. For example,
Toggle Buttons 1, 2, 3, and 4 will modify cell A1, B1, C1 and D1.

Instead of having to create code for each individual togglebuttons, such as
sub togglebutton1_click()
----
end sub

togglebutton2_click()
----
end sub

is there any way that I can use the case function, for example

case is 1
----
case is 2
---
and so on?

Thank you in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default multiple toggle buttons

I haven't tried it but this might work...
Catch the on_change event and use the address from the "Target" as the input
into your case statement.

"Nelson" wrote:

Hello,

I have multiple toggle buttons in an excel sheet that I need to generate
some behavior.

Although, they are lined up to perform identical tasks. For example,
Toggle Buttons 1, 2, 3, and 4 will modify cell A1, B1, C1 and D1.

Instead of having to create code for each individual togglebuttons, such as
sub togglebutton1_click()
----
end sub

togglebutton2_click()
----
end sub

is there any way that I can use the case function, for example

case is 1
----
case is 2
---
and so on?

Thank you in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default multiple toggle buttons

Nelson,

The individual click events are required to respond to the toggle clicks.
Although you could set up a generic routine that is called from each of
these, with a variable that uses the toggle number, such as

Private Sub ToggleButton1_Click()
ToggleAction 1
End Sub

Private Sub ToggleButton2_Click()
ToggleAction 2
End Sub

etc.

Sub ToggleAction(idx As Long)

Range("A" & idx).Value = "Something"

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nelson" wrote in message
...
Actually, what I meant was...
can I use a for i=1 to 4

togglebutton(i)

cell(Ai)="Something"
next i

thanks

"Nelson" wrote:

Hello,

I have multiple toggle buttons in an excel sheet that I need to generate
some behavior.

Although, they are lined up to perform identical tasks. For example,
Toggle Buttons 1, 2, 3, and 4 will modify cell A1, B1, C1 and D1.

Instead of having to create code for each individual togglebuttons, such

as
sub togglebutton1_click()
----
end sub

togglebutton2_click()
----
end sub

is there any way that I can use the case function, for example

case is 1
----
case is 2
---
and so on?

Thank you in advance.



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
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
Stop toggle buttons in excel move from the cells after previewing naveen Excel Discussion (Misc queries) 2 April 8th 05 03:26 AM
Toggle multiple values in single cell Chandni Excel Worksheet Functions 5 February 10th 05 12:48 AM
Specifying activesheets to multiple buttons....possible? marty6[_12_] Excel Programming 7 May 15th 04 01:49 PM
How can I use the Spin or Toggle buttons to change cell values PKyle Excel Programming 1 April 7th 04 10:39 PM


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