Hello;
This is not a question. I am writing it in case someone benefits.
I was trying to write a checkbox into a dropdown on a UserForm such as is possible with datasheets in Access. But I decided to work write off the sheet itself, which means finding a way to create a checkbox in the cell. The table lists training modules available, and by double-clicking the first cell in each row the user basically selects each module that is to be sent to the volunteers. The checkbox data is remembered because it is saved in that same cell, and can be referenced during code that populates a different spreadsheet with the new information (which volunteers get which training). I also wanted to do this dynamically so that a new row would create another instance of the checkbox.
Maybe someone has a code that will work, but here is my workaround.
So I format the column as Wingdings. I then added this code to that sheet.
Okay, so it's a cheat, but only the coder knows that the cell is actually a Wingding view of special characters 168, and 254. The user will see this...Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim myval As Variant If Not Intersect(Range("IssueModule"), Target) Is Nothing Then myval = Target.Value If myval = "" Or myval = "¨" Then Target.Value = "þ" ' "þ" in Wingdings looks like a checked box, while "¨" looks like unchecked box If myval = "þ" Then Target.Value = "¨" Cancel = True End If End Sub
Screenshot.png
I think it is slick, and it works dynamically without extra code. But sometimes my 'slick' is built to need improvement at a later date. Does anyone foresee problems?
Gary