Turning Cell into Checkbox

  • Thread starter Thread starter lorenodonnell
  • Start date Start date
L

lorenodonnell

Does anyone know a simple way of converting a cell into a checkbox
format in an excel spreadsheet?
 
Maybe not what you're looking for, but . . .
You can add a checkbox on top of the cell and link the cell to the
checkbox.
 
copy this entire code in a module,
highlite where you want the checkbox and run the macro
when you click on the cell a check mark will appear
only problem is, you can't enter text in the box because the webdings
font is what creats the check mark
Dave



Sub AddCheckboxesMarlett()
On Error Resume Next
Dim c As Range, myRange As Range
Set c = ActiveCell
Set myRange = Selection
For Each c In myRange
With c
FormatConditions.Delete
FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
_
Formula1:="=""a"""
FormatConditions(1).Interior.ColorIndex = 6
Font.Name = "Marlett"
End With
ActiveSheet.Shapes.AddShape(msoShapeRectangle, c.Left, c.Top,
c.Width, c.Height).Select
With Selection
ShapeRange.Fill.Visible = msoFalse
Name = c.Address
OnAction = "ToggleCheckbox"
End With
Next
myRange.Select
End Sub

Sub ToggleCheckbox()
On Error Resume Next
Dim shp As String
shp = Application.Caller
If Range(shp).Value = "a" Then Range(shp).Value = "" Else
Range(shp).Value = "a"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top