#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
adyer
 
Posts: n/a
Default Check Boxes

Is there a way that I can insert check boxes into an excel spreadsheet?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default Check Boxes

Hi

The following code will place a series of checkboxes alongside values in
another column, in Column G in this example.

Sub CreateCheckBoxes()
On Error Resume Next
Dim c As Range, myRange As Range, lastcell As Long
If Application.ScreenUpdating = True _
Then Application.ScreenUpdating = False
lastcell = Cells(Rows.Count, 6).End(xlUp).Row
Set myRange = Range("G1:G" & lastcell)
For Each c In myRange.Cells
ActiveSheet.CheckBoxes.Add(c.Left, _
c.Top, c.Width, c.Height).Select
With Selection
.LinkedCell = c.Address
.Characters.Text = ""
.Name = "Check" & c.Address
.Display3DShading = True
End With
Next
myRange.Select
Selection.ColumnWidth = 2.15
Application.ScreenUpdating = True
End Sub

After ticking, just check whether value of cell in G is TRUE or FALSE
You can copy the code I posted and paste it into your Visual Basic
Editor
(VBE) in a Standard Module located in your project (workbook). Shortcut
keys would be ..

Alt + F11 (open VBE)
Ctrl + R (open Project Explorer)
Select file on left
If no modules exist:
Insert | Module
Paste code in Module
If modules exist:
Double click desired module
Paste code in Module
Add code as desired

--
Regards

Roger Govier


"adyer" wrote in message
...
Is there a way that I can insert check boxes into an excel
spreadsheet?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dmexcel
 
Posts: n/a
Default Check Boxes

Hi Roger,
I was playing around with your code, is there a way to ensure that the
checkBoxes won't group together. if I put a formula in column H like
=If(G1=True,2,1) and copied this down to the end of the checkbox row
after this the boxes became grouped

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
Filtering by Check Boxes Eggtavius Excel Discussion (Misc queries) 2 January 18th 06 04:41 AM
Can you sort with check boxes? Q Excel Discussion (Misc queries) 3 November 10th 05 08:11 PM
check boxes - copy MarkT Excel Discussion (Misc queries) 2 October 20th 05 04:33 PM
Check boxes - when one box is checked, I want a 2nd box to auto ch Russell-stanely Excel Discussion (Misc queries) 2 July 1st 05 08:52 PM
count check boxes Tony Excel Worksheet Functions 3 April 8th 05 03:48 AM


All times are GMT +1. The time now is 11:22 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"