Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Check Boxes
Is there a way that I can insert check boxes into an excel spreadsheet?
|
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filtering by Check Boxes | Excel Discussion (Misc queries) | |||
Can you sort with check boxes? | Excel Discussion (Misc queries) | |||
check boxes - copy | Excel Discussion (Misc queries) | |||
Check boxes - when one box is checked, I want a 2nd box to auto ch | Excel Discussion (Misc queries) | |||
count check boxes | Excel Worksheet Functions |