ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button (https://www.excelbanter.com/excel-programming/414455-command-button.html)

Randy

Command Button
 
Is it possible to make a commandbutton stay sunken when clicked?
Thanks

Susan

Command Button
 
no, that would be a toggle button.
:)
susan


On Jul 23, 8:53*am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked? *
Thanks



Cerberus

Command Button
 
Hey, quick question about toggle buttons if you don't mind. Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up.

Sorry to jump in and ask another question on someone elses question. I
don't know if that goes against some kind of message board etiquette.

"Susan" wrote:

no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked?
Thanks




ranswrt

Command Button
 
Thanks I new it was an easy answer.

"Susan" wrote:

no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked?
Thanks




Susan

Command Button
 
ha ha the thread's been hijacked! no i don't think it's an
issue.............

anyway, i thought that if a group of toggle buttons is on a userform &
you put them all in a frame, then they might behave as option buttons
& only one can be selected...... but no, you can select them all.

so whether they're in a userform or if they're on a spreadsheet & you
want the behavior you described, you would have to CODE it that way,
by using grouping or tags - each time one was selected, you'd loop
through all the others & make sure they are all "false" or "true",
whichever you want.

if typeof ocontrol is msforms.togglebutton and
ocontrol.tag = "Group" then
ocontrol.value = false
end if

something like that.
hope it helps!
susan


On Jul 23, 9:38*am, Cerberus wrote:
Hey, quick question about toggle buttons if you don't mind. *Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. *So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up. *

Sorry to jump in and ask another question on someone elses question. *I
don't know if that goes against some kind of message board etiquette.



"Susan" wrote:
no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked? *
Thanks- Hide quoted text -


- Show quoted text -



Susan

Command Button
 
wow, this is harder then you'd think. because when you go to set the
other toggle buttons to false, it triggers the click event
again.......... i'm going round & round with boolean values & trying
to figure out the logic. i'll betcha there's something simple i'm
missing (application.enableevents=false doesn't work with userforms)
but i haven't found it yet.
susan



On Jul 23, 9:58*am, Susan wrote:
ha ha the thread's been hijacked! *no i don't think it's an
issue.............

anyway, i thought that if a group of toggle buttons is on a userform &
you put them all in a frame, then they might behave as option buttons
& only one can be selected...... but no, you can select them all.

so whether they're in a userform or if they're on a spreadsheet & you
want the behavior you described, you would have to CODE it that way,
by using grouping or tags - each time one was selected, you'd loop
through all the others & make sure they are all "false" or "true",
whichever you want.

if typeof ocontrol is msforms.togglebutton and
ocontrol.tag = "Group" then
ocontrol.value = false
end if

something like that.
hope it helps!
susan

On Jul 23, 9:38*am, Cerberus wrote:



Hey, quick question about toggle buttons if you don't mind. *Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. *So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up. *


Sorry to jump in and ask another question on someone elses question. *I
don't know if that goes against some kind of message board etiquette.


"Susan" wrote:
no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked? *
Thanks- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



Cerberus

Command Button
 
Sounds do-able... Would I have to put that CODE in evey Toggle Click or would
one do the trick. Thanks for the help Susan.

"Susan" wrote:

ha ha the thread's been hijacked! no i don't think it's an
issue.............

anyway, i thought that if a group of toggle buttons is on a userform &
you put them all in a frame, then they might behave as option buttons
& only one can be selected...... but no, you can select them all.

so whether they're in a userform or if they're on a spreadsheet & you
want the behavior you described, you would have to CODE it that way,
by using grouping or tags - each time one was selected, you'd loop
through all the others & make sure they are all "false" or "true",
whichever you want.

if typeof ocontrol is msforms.togglebutton and
ocontrol.tag = "Group" then
ocontrol.value = false
end if

something like that.
hope it helps!
susan


On Jul 23, 9:38 am, Cerberus wrote:
Hey, quick question about toggle buttons if you don't mind. Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up.

Sorry to jump in and ask another question on someone elses question. I
don't know if that goes against some kind of message board etiquette.



"Susan" wrote:
no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked?
Thanks- Hide quoted text -


- Show quoted text -




Susan

Command Button
 
just to close out the thread, here's another thread that discusses the
problems i was having & the the solution they came up with.........

http://groups.google.com/group/micro... fefba2518a42f

ultimately the solution they came up with was to go with something
different, because they couldn't make it work very easily!
susan


On Jul 23, 10:29*am, Cerberus wrote:
Sounds do-able... Would I have to put that CODE in evey Toggle Click or would
one do the trick. *Thanks for the help Susan.



"Susan" wrote:
ha ha the thread's been hijacked! *no i don't think it's an
issue.............


anyway, i thought that if a group of toggle buttons is on a userform &
you put them all in a frame, then they might behave as option buttons
& only one can be selected...... but no, you can select them all.


so whether they're in a userform or if they're on a spreadsheet & you
want the behavior you described, you would have to CODE it that way,
by using grouping or tags - each time one was selected, you'd loop
through all the others & make sure they are all "false" or "true",
whichever you want.


if typeof ocontrol is msforms.togglebutton and
ocontrol.tag = "Group" then
ocontrol.value = false
end if


something like that.
hope it helps!
susan


On Jul 23, 9:38 am, Cerberus wrote:
Hey, quick question about toggle buttons if you don't mind. *Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. *So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up. *


Sorry to jump in and ask another question on someone elses question. *I
don't know if that goes against some kind of message board etiquette.


"Susan" wrote:
no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked? *
Thanks- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



Cerberus

Command Button
 
That sucks, I have 32 different toggle buttons with a "paint sample" on each
one of them. Oh well :(, live and learn huh. Thanks for looking into that
for me though.

"Susan" wrote:

just to close out the thread, here's another thread that discusses the
problems i was having & the the solution they came up with.........

http://groups.google.com/group/micro... fefba2518a42f

ultimately the solution they came up with was to go with something
different, because they couldn't make it work very easily!
susan


On Jul 23, 10:29 am, Cerberus wrote:
Sounds do-able... Would I have to put that CODE in evey Toggle Click or would
one do the trick. Thanks for the help Susan.



"Susan" wrote:
ha ha the thread's been hijacked! no i don't think it's an
issue.............


anyway, i thought that if a group of toggle buttons is on a userform &
you put them all in a frame, then they might behave as option buttons
& only one can be selected...... but no, you can select them all.


so whether they're in a userform or if they're on a spreadsheet & you
want the behavior you described, you would have to CODE it that way,
by using grouping or tags - each time one was selected, you'd loop
through all the others & make sure they are all "false" or "true",
whichever you want.


if typeof ocontrol is msforms.togglebutton and
ocontrol.tag = "Group" then
ocontrol.value = false
end if


something like that.
hope it helps!
susan


On Jul 23, 9:38 am, Cerberus wrote:
Hey, quick question about toggle buttons if you don't mind. Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up.


Sorry to jump in and ask another question on someone elses question. I
don't know if that goes against some kind of message board etiquette.


"Susan" wrote:
no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked?
Thanks- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




Alan

Command Button
 
You could place this code behind each togglebutton. Each time a click is
made, it resets the value of all other togglebuttons to false. Put the
togglebuttons in a frame, called Frame1 in this code. Change ToggleButton1 to
the name of each togglebutton as you place the code behind that button.

Private Sub ToggleButton1_Click()
Dim cCont As Control
For Each cCont In Me.Frame1.Controls
If cCont.Name = "ToggleButton1" Then 'Change this name to each
buttons name.
cCont.Value = True
Else
cCont.Value = False
End If
Next cCont
End Sub


Alan



"Cerberus" wrote:

Hey, quick question about toggle buttons if you don't mind. Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up.

Sorry to jump in and ask another question on someone elses question. I
don't know if that goes against some kind of message board etiquette.

"Susan" wrote:

no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked?
Thanks




Susan

Command Button
 
Alan -
yes, that works.......... kinda. but the problem the other thread
had, and what i found too, is that i could make it work (& your sub
works) in order only. if you start with togglebutton1 and move
through them, fine, but if you want to go back or jump around, it
sticks at the last one.
but thanks for your efforts!
:)
susan



On Jul 23, 2:37*pm, Alan wrote:
You could place this code behind each togglebutton. Each time a click is
made, it resets the value of all other togglebuttons to false. Put the
togglebuttons in a frame, called Frame1 in this code. Change ToggleButton1 to
the name of each togglebutton as you place the code behind that button.

Private Sub ToggleButton1_Click()
Dim cCont As Control
* * For Each cCont In Me.Frame1.Controls
* * * * If cCont.Name = "ToggleButton1" Then * 'Change this name to each
buttons name.
* * * * * * cCont.Value = True
* * * * Else
* * * * * * cCont.Value = False
* * * * End If
* * *Next cCont
End Sub

Alan



"Cerberus" wrote:
Hey, quick question about toggle buttons if you don't mind. *Is there a way
to put a condition to a group of toggle buttons that says only one can be
selected at a time. *So let's say if we have 10 toggle buttons in a group and
slection A was pressed and then you decide selection C is better for you,
selection A will "pop" back up. *


Sorry to jump in and ask another question on someone elses question. *I
don't know if that goes against some kind of message board etiquette.


"Susan" wrote:


no, that would be a toggle button.
:)
susan


On Jul 23, 8:53 am, randy wrote:
Is it possible to make a commandbutton stay sunken when clicked? *
Thanks- Hide quoted text -


- Show quoted text -




All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com