#1   Report Post  
MarkT
 
Posts: n/a
Default check boxes - copy

I would like to copy (hundreds) of check boxes in a spreadsheet. The
checkbox must be assigned to a cell to work in a formula. When I copy the
checkbox down however, all check boxes will either be checked, or unchecked.

Is there a way to copy check boxes, when they are assigned to another cell,
so that each check box can be used individually? I created the check boxes
through the forms toolbar.

Thanks for your help, this is a great forum and I only hope to give some day
as much help as I am currently receiving!
  #2   Report Post  
Dave O
 
Posts: n/a
Default check boxes - copy

Hey, Mark-
Things got busy yesterday, and I missed your post.

You can think of a checkbox as a control that is layered on top of your
spreadsheet and works with it- but when you copy a checkbox you're
copying that control and not the cell references within it. That's why
you the "refers to" cell in the checkbox parameters don't change when
you move the checkbox.

I wrote some code that will create a number of checkboxes that you
specify, starting on a row that you specify. It creates a new checkbox
for each row and a unique cell reference on that same row.

Depending on how your spreadsheet it arranged and formatted, you may
need to change some things in the following lines of code. In this
line,
ActiveSheet.CheckBoxes.Add(10.5, 0 + ((K - 1) * 12.75), 5, 10).Select
10.5 is the horizontal distance from the left margin of your sprdsht
0 + ((K - 1) * 12.75 is the vertical distance from the top of the
sprdsht
5 is the control width
10 is the control height
The 10.5 setting lands the checkbox in column A- you may want to adjust
that
The 0 + ((K - 1) * 12.75 setting assumes the default row height of
12.75. You may need to adjust that to match the row height of your
spreadsheet.

This line
Adrs = "B" & K
....situates the TRUE / FALSE cell in column B

Input windows will appear asking which row to start on, and how many
checkboxes to create.

The code follows:
Sub Many_Checkboxes()
Dim Adrs As String
Dim K As Long
Dim Beg As Long, Fin As Long

Beg = InputBox("Start on what row?")
Fin = InputBox("How many checkboxes?")

For K = Beg To Fin
Adrs = "B" & K

ActiveSheet.CheckBoxes.Add(10.5, 0 + ((K - 1) * 12.75), 5, 10).Select
Selection.Characters.Text = ""

With Selection
.Value = xlOn
.LinkedCell = Adrs
.Display3DShading = False

End With
Next K
End Sub

  #3   Report Post  
MarkT
 
Posts: n/a
Default check boxes - copy

Thanks Dave, your solution sounds exactly what I was looking for.

Thanks for all your help, I appreciate it very much.

Mark

"Dave O" wrote:

Hey, Mark-
Things got busy yesterday, and I missed your post.

You can think of a checkbox as a control that is layered on top of your
spreadsheet and works with it- but when you copy a checkbox you're
copying that control and not the cell references within it. That's why
you the "refers to" cell in the checkbox parameters don't change when
you move the checkbox.

I wrote some code that will create a number of checkboxes that you
specify, starting on a row that you specify. It creates a new checkbox
for each row and a unique cell reference on that same row.

Depending on how your spreadsheet it arranged and formatted, you may
need to change some things in the following lines of code. In this
line,
ActiveSheet.CheckBoxes.Add(10.5, 0 + ((K - 1) * 12.75), 5, 10).Select
10.5 is the horizontal distance from the left margin of your sprdsht
0 + ((K - 1) * 12.75 is the vertical distance from the top of the
sprdsht
5 is the control width
10 is the control height
The 10.5 setting lands the checkbox in column A- you may want to adjust
that
The 0 + ((K - 1) * 12.75 setting assumes the default row height of
12.75. You may need to adjust that to match the row height of your
spreadsheet.

This line
Adrs = "B" & K
....situates the TRUE / FALSE cell in column B

Input windows will appear asking which row to start on, and how many
checkboxes to create.

The code follows:
Sub Many_Checkboxes()
Dim Adrs As String
Dim K As Long
Dim Beg As Long, Fin As Long

Beg = InputBox("Start on what row?")
Fin = InputBox("How many checkboxes?")

For K = Beg To Fin
Adrs = "B" & K

ActiveSheet.CheckBoxes.Add(10.5, 0 + ((K - 1) * 12.75), 5, 10).Select
Selection.Characters.Text = ""

With Selection
.Value = xlOn
.LinkedCell = Adrs
.Display3DShading = False

End With
Next K
End Sub


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
Check Boxes Bruce Excel Discussion (Misc queries) 1 August 27th 05 11:37 PM
Column of check boxes DavidE Excel Worksheet Functions 2 July 15th 05 12:46 AM
Copy drop down boxes and associate to cells dynamically in excel t Killion Excel Worksheet Functions 2 June 10th 05 03:11 PM
check boxes that highlight row static69 Excel Discussion (Misc queries) 2 May 28th 05 12:07 PM
Count Check Boxes Tony Excel Worksheet Functions 4 April 12th 05 05:58 PM


All times are GMT +1. The time now is 08:12 AM.

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

About Us

"It's about Microsoft Excel"