Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Assign Macro to Checkbox

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Assign Macro to Checkbox

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Assign Macro to Checkbox

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" wrote in message
ups.com...
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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Assign Macro to Checkbox

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" wrote in message
ups.com...
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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Assign Macro to Checkbox

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" wrote in message
oups.com...
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" wrote in message
ups.com...
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.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Assign Macro to Checkbox

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" wrote in message
oups.com...
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" wrote in message
ups.com...
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.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Assign Macro to Checkbox

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" wrote in message
oups.com...
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" wrote in message
ups.com...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASSIGN VALUE TO CHECKBOX AND CALCULATE AVERAGE? nickee New Users to Excel 2 January 10th 09 09:44 PM
Assign a Macro The Rook[_2_] Excel Discussion (Misc queries) 5 February 19th 07 06:53 PM
Assign Macro David Excel Worksheet Functions 1 October 9th 06 03:31 AM
Assign Macro James Hamilton Excel Discussion (Misc queries) 2 November 2nd 05 10:56 PM
Assign macro jenniferThomson Excel Programming 5 September 15th 05 09:36 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"