LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Code for many check boxes

The original post has disappeared (for me).

But as an alternative, the OP could use checkboxes from the Forms toolbar. Each
of those could be assigned the same macro.

I'm not sure how the code varies for each checkbox, but you can determine which
checkbox called the macro with code like:

Option Explicit
Sub testme()

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

MsgBox myCBX.TopLeftCell.Address '.row or .column will work, too.

End Sub

Bob wrote:

Doug,
How do you write the common sub or function? Each check box range increases by one is the only difference.
Thank you very much for your help. Bob

----- Doug Broad wrote: -----

Bob,
AFAIK, each checkbox must have its own click sub. You
can cut and paste the guts from each program or call
a common sub or function if each checkbox does substantially
the same thing.

Regards,
Doug


"Bob" wrote in message ...
How can this code be written for 10 - 20 check boxes in a row that do the same thing?
So I do not have to write the code 10 - 20 times for each box?
Private Sub CheckBox2_Click()

With CheckBox2
If .Value = True Then
Worksheets(2).Range("A9:C9").Value =
ActiveSheet.Range("A9:C9").Value
Else
Worksheets(2).Range("A9:C9").Value = ""
End If
End With
End Sub
Please help! Thank You



--

Dave Peterson



 
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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
VBA code for the Check Boxes in a form HKS Excel Discussion (Misc queries) 3 June 24th 08 09:42 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
Code for Many check boxes Bob Excel Programming 0 January 23rd 04 02:16 AM
code to hide check boxes Matt Excel Programming 4 January 10th 04 06:31 PM


All times are GMT +1. The time now is 09:40 AM.

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"