PC Review


Reply
Thread Tools Rate Thread

Assign Macro to Checkbox

 
 
jafsonic
Guest
Posts: n/a
 
      23rd Oct 2006
I have a series of checkboxes which affect conditional formatting in
other cells in each given row where the checkbox is located. The code
is generic enough to use with every checkbox. I could call a
subroutine from each checkboxY.click command, but is there a way to set
all the checkboxes to just use the one routine?

Thanks, this is driving me nuts and I don't want to have to edit EVERY
single macro.

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      23rd Oct 2006
If you used a checkbox from the Forms toolbar, you could assign the same macro
to each checkbox.

Option Explicit
Sub testme()

Dim CBX As CheckBox
Set CBX = ActiveSheet.CheckBoxes(Application.Caller)

If CBX.Value = xlOn Then
MsgBox "it's checked"
Else
MsgBox "Nope"
End If

MsgBox CBX.Name & vbLf & CBX.TopLeftCell.Address(0, 0)

End Sub


Rightclick on the checkbox and choose assign macro. This macro would go into a
General module--not behind the worksheet like the code for checkboxes for the
control toolbox toolbar version.

jafsonic wrote:
>
> I have a series of checkboxes which affect conditional formatting in
> other cells in each given row where the checkbox is located. The code
> is generic enough to use with every checkbox. I could call a
> subroutine from each checkboxY.click command, but is there a way to set
> all the checkboxes to just use the one routine?
>
> Thanks, this is driving me nuts and I don't want to have to edit EVERY
> single macro.


--

Dave Peterson
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      23rd Oct 2006
Use checkboxes from the Forms toolbar, and assign them all to the same
macro, use

Application.Caller

to check which has been clicked.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"jafsonic" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a series of checkboxes which affect conditional formatting in
> other cells in each given row where the checkbox is located. The code
> is generic enough to use with every checkbox. I could call a
> subroutine from each checkboxY.click command, but is there a way to set
> all the checkboxes to just use the one routine?
>
> Thanks, this is driving me nuts and I don't want to have to edit EVERY
> single macro.
>



 
Reply With Quote
 
jafsonic
Guest
Posts: n/a
 
      24th Oct 2006
Thank You,

If I use a forms checkbox, will I still be able to reference the
current / selected row that the checkbox is in?

Bob Phillips wrote:
> Use checkboxes from the Forms toolbar, and assign them all to the same
> macro, use
>
> Application.Caller
>
> to check which has been clicked.
>
> --
>
> HTH
>
> Bob Phillips
>
> (replace xxxx in the email address with gmail if mailing direct)
>
> "jafsonic" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have a series of checkboxes which affect conditional formatting in
> > other cells in each given row where the checkbox is located. The code
> > is generic enough to use with every checkbox. I could call a
> > subroutine from each checkboxY.click command, but is there a way to set
> > all the checkboxes to just use the one routine?
> >
> > Thanks, this is driving me nuts and I don't want to have to edit EVERY
> > single macro.
> >


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      24th Oct 2006
Checkboxes, from the Forms toolbar or the Controls toolbox, do not reside on
a row, they are on a layer extra the worksheet. You could link it tom a
cell, but better to just check the name IMO

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"jafsonic" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank You,
>
> If I use a forms checkbox, will I still be able to reference the
> current / selected row that the checkbox is in?
>
> Bob Phillips wrote:
> > Use checkboxes from the Forms toolbar, and assign them all to the same
> > macro, use
> >
> > Application.Caller
> >
> > to check which has been clicked.
> >
> > --
> >
> > HTH
> >
> > Bob Phillips
> >
> > (replace xxxx in the email address with gmail if mailing direct)
> >
> > "jafsonic" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I have a series of checkboxes which affect conditional formatting in
> > > other cells in each given row where the checkbox is located. The code
> > > is generic enough to use with every checkbox. I could call a
> > > subroutine from each checkboxY.click command, but is there a way to

set
> > > all the checkboxes to just use the one routine?
> > >
> > > Thanks, this is driving me nuts and I don't want to have to edit EVERY
> > > single macro.
> > >

>



 
Reply With Quote
 
jafsonic
Guest
Posts: n/a
 
      3rd Nov 2006
IMO?


Bob Phillips wrote:
> Checkboxes, from the Forms toolbar or the Controls toolbox, do not reside on
> a row, they are on a layer extra the worksheet. You could link it tom a
> cell, but better to just check the name IMO
>
> --
>
> HTH
>
> Bob Phillips
>
> (replace xxxx in the email address with gmail if mailing direct)
>
> "jafsonic" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Thank You,
> >
> > If I use a forms checkbox, will I still be able to reference the
> > current / selected row that the checkbox is in?
> >
> > Bob Phillips wrote:
> > > Use checkboxes from the Forms toolbar, and assign them all to the same
> > > macro, use
> > >
> > > Application.Caller
> > >
> > > to check which has been clicked.
> > >
> > > --
> > >
> > > HTH
> > >
> > > Bob Phillips
> > >
> > > (replace xxxx in the email address with gmail if mailing direct)
> > >
> > > "jafsonic" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I have a series of checkboxes which affect conditional formatting in
> > > > other cells in each given row where the checkbox is located. The code
> > > > is generic enough to use with every checkbox. I could call a
> > > > subroutine from each checkboxY.click command, but is there a way to

> set
> > > > all the checkboxes to just use the one routine?
> > > >
> > > > Thanks, this is driving me nuts and I don't want to have to edit EVERY
> > > > single macro.
> > > >

> >


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Nov 2006
In my opinion.

http://www.acronymfinder.com/af-quer...=IMO&Find=Find

jafsonic wrote:
>
> IMO?
>
> Bob Phillips wrote:
> > Checkboxes, from the Forms toolbar or the Controls toolbox, do not reside on
> > a row, they are on a layer extra the worksheet. You could link it tom a
> > cell, but better to just check the name IMO
> >
> > --
> >
> > HTH
> >
> > Bob Phillips
> >
> > (replace xxxx in the email address with gmail if mailing direct)
> >
> > "jafsonic" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Thank You,
> > >
> > > If I use a forms checkbox, will I still be able to reference the
> > > current / selected row that the checkbox is in?
> > >
> > > Bob Phillips wrote:
> > > > Use checkboxes from the Forms toolbar, and assign them all to the same
> > > > macro, use
> > > >
> > > > Application.Caller
> > > >
> > > > to check which has been clicked.
> > > >
> > > > --
> > > >
> > > > HTH
> > > >
> > > > Bob Phillips
> > > >
> > > > (replace xxxx in the email address with gmail if mailing direct)
> > > >
> > > > "jafsonic" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > I have a series of checkboxes which affect conditional formatting in
> > > > > other cells in each given row where the checkbox is located. The code
> > > > > is generic enough to use with every checkbox. I could call a
> > > > > subroutine from each checkboxY.click command, but is there a way to

> > set
> > > > > all the checkboxes to just use the one routine?
> > > > >
> > > > > Thanks, this is driving me nuts and I don't want to have to edit EVERY
> > > > > single macro.
> > > > >
> > >


--

Dave Peterson
 
Reply With Quote
 
jafsonic
Guest
Posts: n/a
 
      7th Nov 2006
Thanks, Dave... and btw, your code worked like a charm when adapted to
my application.

Thanks... again.


Dave Peterson wrote:
> In my opinion.
>
> http://www.acronymfinder.com/af-quer...=IMO&Find=Find
>
> jafsonic wrote:
> >
> > IMO?
> >
> > Bob Phillips wrote:
> > > Checkboxes, from the Forms toolbar or the Controls toolbox, do not reside on
> > > a row, they are on a layer extra the worksheet. You could link it tom a
> > > cell, but better to just check the name IMO
> > >
> > > --
> > >
> > > HTH
> > >
> > > Bob Phillips
> > >
> > > (replace xxxx in the email address with gmail if mailing direct)
> > >
> > > "jafsonic" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Thank You,
> > > >
> > > > If I use a forms checkbox, will I still be able to reference the
> > > > current / selected row that the checkbox is in?
> > > >
> > > > Bob Phillips wrote:
> > > > > Use checkboxes from the Forms toolbar, and assign them all to the same
> > > > > macro, use
> > > > >
> > > > > Application.Caller
> > > > >
> > > > > to check which has been clicked.
> > > > >
> > > > > --
> > > > >
> > > > > HTH
> > > > >
> > > > > Bob Phillips
> > > > >
> > > > > (replace xxxx in the email address with gmail if mailing direct)
> > > > >
> > > > > "jafsonic" <(E-Mail Removed)> wrote in message
> > > > > news:(E-Mail Removed)...
> > > > > > I have a series of checkboxes which affect conditional formatting in
> > > > > > other cells in each given row where the checkbox is located. The code
> > > > > > is generic enough to use with every checkbox. I could call a
> > > > > > subroutine from each checkboxY.click command, but is there a way to
> > > set
> > > > > > all the checkboxes to just use the one routine?
> > > > > >
> > > > > > Thanks, this is driving me nuts and I don't want to have to edit EVERY
> > > > > > single macro.
> > > > > >
> > > >

>
> --
>
> Dave Peterson


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      8th Nov 2006
Good to hear.

jafsonic wrote:
>
> Thanks, Dave... and btw, your code worked like a charm when adapted to
> my application.
>
> Thanks... again.
>
> Dave Peterson wrote:
> > In my opinion.
> >
> > http://www.acronymfinder.com/af-quer...=IMO&Find=Find
> >
> > jafsonic wrote:
> > >
> > > IMO?
> > >
> > > Bob Phillips wrote:
> > > > Checkboxes, from the Forms toolbar or the Controls toolbox, do not reside on
> > > > a row, they are on a layer extra the worksheet. You could link it tom a
> > > > cell, but better to just check the name IMO
> > > >
> > > > --
> > > >
> > > > HTH
> > > >
> > > > Bob Phillips
> > > >
> > > > (replace xxxx in the email address with gmail if mailing direct)
> > > >
> > > > "jafsonic" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > Thank You,
> > > > >
> > > > > If I use a forms checkbox, will I still be able to reference the
> > > > > current / selected row that the checkbox is in?
> > > > >
> > > > > Bob Phillips wrote:
> > > > > > Use checkboxes from the Forms toolbar, and assign them all to the same
> > > > > > macro, use
> > > > > >
> > > > > > Application.Caller
> > > > > >
> > > > > > to check which has been clicked.
> > > > > >
> > > > > > --
> > > > > >
> > > > > > HTH
> > > > > >
> > > > > > Bob Phillips
> > > > > >
> > > > > > (replace xxxx in the email address with gmail if mailing direct)
> > > > > >
> > > > > > "jafsonic" <(E-Mail Removed)> wrote in message
> > > > > > news:(E-Mail Removed)...
> > > > > > > I have a series of checkboxes which affect conditional formatting in
> > > > > > > other cells in each given row where the checkbox is located. The code
> > > > > > > is generic enough to use with every checkbox. I could call a
> > > > > > > subroutine from each checkboxY.click command, but is there a way to
> > > > set
> > > > > > > all the checkboxes to just use the one routine?
> > > > > > >
> > > > > > > Thanks, this is driving me nuts and I don't want to have to edit EVERY
> > > > > > > single macro.
> > > > > > >
> > > > >

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASSIGN VALUE TO CHECKBOX AND CALCULATE AVERAGE? nickee Microsoft Excel New Users 2 10th Jan 2009 09:44 PM
Assign cell to checkbox Boss Microsoft Excel Programming 6 16th Jan 2008 05:24 PM
Checkbox - assign value/sum values ***HELP*** suznal Microsoft Excel Programming 0 14th Jan 2008 08:34 PM
Assign value to yes/no checkbox or text box ILoveAccess via AccessMonster.com Microsoft Access Reports 5 16th Mar 2006 09:09 PM
Assign ID to a radiobutton inside a checkbox Abhishek Srivastava Microsoft ASP .NET 2 2nd Mar 2004 06:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:49 PM.