how to change a toggle button caption based on a certain cell

excelNuts

New Member
Joined
Oct 31, 2017
Messages
8
hello dear friends just registered in here i have a problem in excel vba
i made a user form with about 60 toggle buttons to show hide accounts in the main sheet
so my problem is i wanna make a code that if change the name of the account in the sheet the caption in the toggle button changes too any help would be much appreciated

this is the code but it doesn't work at all

Private Sub Worksheet_Activate()
ToggleButtons("ToggleButton19").Caption = Sheets("Sheet1").Range("J3")
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi & welcome to the board.

Try this in the UserForm_Initialize event
Code:
ToggleButton1.Caption = Sheets("Sheet1").Range("J3").Value
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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