autofit a checkbox to the appropriate cell

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
 
B

Bob Phillips

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
 

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

Top