autofit a checkbox to the appropriate cell

  • Thread starter Thread starter Vi
  • Start date Start date
V

Vi

Hello All,

I have a column of checkboxes with the appropriate
comments in another column:

For example:

Do you like to eat? {Checkbox here}
Do you like to sleep? {Checkbox here}

'Do you like to eat?' is in one column and the checkbox is
in another. How do I 'autofit' the checkboxes to the
comments? When I type something the width of the row
changes depending on how much I type in for the comments.
I want the checkboxes also to reflect that.

If someone can help me it would be terrific!
Thanks,
Vi
 
Vi,

two suggestions.

1. put the checkboxes to the left of the comments, with comments in column
B,C or whatever

2. Don't use checkboxes. Here is a suggestion I made some time ago, Just
change the column toi suit


Rather than use a checkbox, I suggest just using a check column. So if we
assume that the data is in A1:A100 (change to suit), clicking in column A
will do what you want with this code. Add this code to the worksheet module
(right-click on the sheet name tab, select the View option, and then paste
this code in).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("A1:A100")) Is Nothing Then
With Target
If .Value = "a" Then
.Value = ""
Else
.Value = "a"
.Font.Name = "Marlett"
End If
End With
End If

sub_exit:
Application.EnableEvents = True
End Sub
 
Back
Top