Please note attachment with an active check box that is too small.
Your CheckBox is actually a Forms CheckBox. Active X CheckBoxes look worse.
Unfortunately, I don't know of a way to change the size of the CheckBox 'Check Area'. I know you say it is complicated for you, but this is the best I am able to do with my technical skill. Try the attached file which has samples of:
a. Forms CheckBox (name usually like 'Check Box 1')
b. Active X CheckBox (name usually like 'CheckBox1') - no spaces in name.
c. Cells that simulate CheckBoxes (and requires VBA) using the Marlett Font. To simulate the CheckBox, you have to 'Double Click' the cell to toggle the value.
The Forms and Active X CheckBoxes use a 'Linked Cell' to get the value in Column 'G'. The 'Simulated CheckBoxes' use a formula to get the 'CheckBox' values in Column 'G'.
The code is in the 'Sheet1' module. The red highlighted area below can be changed to customized to your range of cells that simulate CheckBoxes.
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim sValue As String
If Not Intersect(Target, Range("C11:C16")) Is Nothing Then
'Get the value in the Cell with leading/trailing spaces removed
sValue = Trim(Target.Value)
'If the cell is Empty, Put in a Marlett CheckMark
'If the cell is NOT EMPTY, Clear the Cell Value
If Len(sValue) = 0 Then
Call MarlettCheckBox(Target.Address, "Checkmark")
Else
Target.Value = ""
End If
'Put Normal Focus in the Cell
'Cancel = True
'Move the focus two cells to the right
Target.Offset(0, 2).Select
End If
End Sub
Private Sub MarlettCheckBox(sRange As String, sValue As String)
'This uses the 'Marlett' font to put SPECIAL CHARACTERS in a cell (or range of cells)
'
'Input Values (case insensitive):
'a. CHECKMARK
'b. X
'c. CIRCLE
'd. SQUARE
'e. LEFT ARROW
'f. RIGHT ARROW
'g. UP ARROW
'h. DOWN ARROW
'
'Reference: 'http://www.reactos.org/wiki/Marlett_Characters
Dim myRange As Range
Dim r As Range
Dim sChar As String
Dim sLocalValue As String
'Get the input values and process them as required
Set myRange = Range(sRange)
sLocalValue = UCase(Trim(sValue))
'Generate the character required
Select Case sLocalValue
Case "CHECKMARK"
sChar = "a"
Case "X"
sChar = "r"
Case "CIRCLE"
sChar = "g"
Case "SQUARE"
sChar = "n"
Case "LEFT ARROW"
sChar = "3"
Case "RIGHT ARROW"
sChar = "4"
Case "UP ARROW"
sChar = "5"
Case "DOWN ARROW"
sChar = "6"
End Select
If Len(sChar) > 0 Then
For Each r In myRange
r.Font.Name = "Marlett"
r.HorizontalAlignment = xlCenter
r.Value = sChar
Next r
End If
'Clear object pointer
Set myRange = Nothing
End Sub
To access Visual Basic (VBA) see:
http://www.ablebits.com/office-addin...a-macro-excel/
a. Click on any cell in the Excel Spreadsheet (may not be needed).
b. ALT-F11 to get to VBA.
c. CTRL-R to get project explorer (if it isn't already showing).
d. Double Click on a 'Module Name' in 'Project Explorer' to see code for that module.
To import or export VBA Module Code:
a. To export, right click on the Module Name in the 'Project Explorer'.
b. Select export file. I suggest you use a SubFolder that only contains exported (.bas) files.
Keep the original name.
c. To import, right click anywhere in 'Project Explorer'.
d. Select import file. Select a file to import.
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
This option requires all variables to be declared and will give a compiler error for undeclared variables.
Lewis
Bookmarks