Transfer name of ToggleButton to worksheet ("sheet1")

inactiveUser214710

Board Regular
Joined
Apr 27, 2012
Messages
171
Hello everyone
I have a macro below to open and close toggleButton (Tog1; Tog2; Tog3), only one at a time, in userform1.

Code:
 "MODULE"
Sub TogClick (tog as ToggleButton)
Col collection static like
Dim ctl as control
Dim vCtl as variant

If col is nothing then
Set col = New Collection
For each ctl in UserForm1.Controls
If TypeName (ctl) = "ToggleButton" Then col.Add ctl

Next ctl
End if
End Sub

'=====
Private Sub Tog1_Click () 'title  " CAIXA "
TogClick Tog1      'Macro
End Sub

Private Sub Tog2_Click () 'title    " BANK_1 "
TogClick Tog2       'Macro
End Sub

Private Sub Tog2_Click () 'title   " BANK_2 "
TogClick Tog2         'Macro          
End Sub
[
How to add in the same macro, or another, the code, for the purpose of the title of Tog1, Tog2 or Tog3, pass to the worksheet its name (tog1.caption).
Thank you very much
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top