selected toggle buttons to fill in worksheet

donny1shot

New Member
Joined
Mar 8, 2018
Messages
18
Hi all,
I am trying to use toggle buttons to fill in part of a work sheet and I am trying to get if either one or more are selected the those captions will auto fill a particular cell. However my current code only fills in the final if please help.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Private Sub CommandButton1_Click()
If Apollo.Enabled Then
Sheets("sheet2").Range("d5") = Apollo.Caption

End If

End Sub


That is the current code and I just tried to copy and past it and change the names to suit each toggle. but that didn't work.

sorry I am a real newbie at this.
 
Upvote 0
Explain in more detail what you want. With specifics.

so I have a userform on which I have multiple toggle buttons and when one or more is selected upon clicking my command button I would like all selected toggles to have their respective captions fill in a cell on my worksheet. so for example one of the toggles is named Apollo (as in above code) and that is the caption.

Currently when his is selected alone and I click the command button it fills in the corresponding cell. However I want any button within that section of the form to fill in the cell when multiple are selected they will all fill in that cell

example of the code how I put it previously but only filled in the latter to the cell.
Private Sub CommandButton1_Click()
If Apollo.Enabled Then
Sheets("sheet2").Range("d5") = Apollo.Caption

End If
If Jupiter.Enabled Then
Sheets("sheet2").Range("d5") = Jupiter.Caption

End If

End Sub
 
Upvote 0
So if you have 10 Toggle buttons and all 10 are enable then you want Range("D5" to have 10 ToggleButton captions entered into "D5"

And how do you enable and then unenable your toggle buttons?

Or do you mean if the toggle button is selected which means is True or False

Your subject title says "Selected" not "Enabled" there is a different.

Enable means it set to work unenabled means it will not work
 
Last edited:
Upvote 0
Yes exactly if ten toggles are selected (true) then they will all enter into that cell. that is all I need to know FOR NOW AT LEAST haha.
 
Upvote 0
Yes exactly if ten toggles are selected (true) then they will all enter into that cell. that is all I need to know FOR NOW AT LEAST haha.

Do you want "D5" to look like this:
Apollo
George
Bob
Jane
Jack

Or like
Apollo George Bob Jane Jack
And if like this do we need spaces between each word.
Another case of needing details.


And see you original used the term Enabled and now your using selected = True
It's always important to have specific details

And when you use 10 toggle buttons how do you know which ones are selected and which ones are not selected visually. I see no differents in how the look.

Are you sure this is the best way to do what you want? Why would not selecting values in a listbox be easier.

You can have one listbox select multiple values in the listbox and when you press a button all those values you selected in the listbox would be entered into "D4"

It's a listbox set so you can select multiple items.
 
Upvote 0
I think I could work using list boxes instead of the toggles to be fair might be easier. In simple terms I am trying to create a one trick form that allows my peers to fill in order forms with handwriting or using our current erp as it's crap so one form to cover all options basically.

But yeah list boxes should work fine I think/ hope.
 
Upvote 0
Not sure what this means:
trying to create a one trick form

You never answered how you want these values entered into "D4"

And give me a list of the possible choices to choose from. Like the captions of the Toggle buttons.

And your using a UserForm correct?

And all we will ever be doing is entering values into Range ("D4") is that correct?

Do not assume you will be able to figure things out later to fit your needs.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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