Solved

Excel  2010 - How to insert/create checkboxes in a column of cells.

Posted on 2014-03-19
4
1,629 Views
Last Modified: 2014-03-20
I have a worksheet with data and want to have a checkbox for yes/no options.
How can I create checkboxes inside each cell in a column of cells.
I'm pretty sure I don't need the checkbox inside of
DEVELOPER/CONTROLS/INSERT/FORM CONTROLS/Checkbox

Or am I wrong.  Maybe I don't need checkboxes?
0
Comment
Question by:brothertruffle880
  • 2
4 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 250 total points
Comment Utility
Option buttons would be better for Yes/No.

Sub CreateYesNo()
Dim intQuestions As Integer
Dim intRow As Integer
Dim oleObj As OLEObject

' Uncomment these lines to erase what you did and do it again
'For Each oleObj In ActiveSheet.OLEObjects
'    oleObj.Delete
'Next
intQuestions = InputBox("How many sets of Yes/No option buttons do you want to add?", , 1)

For intRow = 1 To intQuestions
    With ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", _
        Left:=Cells(intRow, 6).Left, _
        Top:=Cells(intRow, 6).Top, _
        Width:=Cells(intRow, 6).Width, _
        Height:=Cells(intRow, 6).Height)
        .Object.Caption = "Yes"
        .Object.GroupName = "Q" & intRow
    End With
    With ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", _
        Left:=Cells(intRow, 7).Left, _
        Top:=Cells(intRow, 7).Top, _
        Width:=Cells(intRow, 7).Width, _
        Height:=Cells(intRow, 7).Height)
        .Object.Caption = "No"
        .Object.GroupName = "Q" & intRow
    End With
Next
End Sub

Open in new window

0
 
LVL 33

Assisted Solution

by:Norie
Norie earned 250 total points
Comment Utility
You could use data validation with a simple Yes/No as a list.
0
 

Author Closing Comment

by:brothertruffle880
Comment Utility
Thank you Both.  Terrific and workable!
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now