Tick Boxes that are attached to a cell

  • Thread starter Thread starter Andibevan
  • Start date Start date
A

Andibevan

Hi All,

I have a spreadsheet that lists resources in column A and There expenses per
month in Column B.

I want to add a tick-box in column C that is essentially embedded / attached
into the cell so that when I copy the rows down it copies the tick box.

I know this is simple but I am not sure which one of the many ways is
required.

Thanks

Andi
 
Andi,

You can get checkboxes to move with a cell (from the Forms toolbar), but if
you want to copy them, that isn't so easy.

How about an alternative idea?

Rather than use a checkbox, I suggest just using a check column. So if we
assume that the data is in A1:E100 (change to suit), clicking in column A
will do what you want with this code.


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
.Offset(0, 1).Activate
End With
End If
sub_exit:
Application.EnableEvents = True
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
 
Bob,

Thanks for the alternative selection. As you have now pointed out copying
the tick boxes isn't easier I think I will just use a data validation list
box with Y / N in it.

They do seem to behave quite bizarely when you copy them. I can manage to
put the tick box in a cell and then copy it down one sheet, but when I try
to copy the cell to a seperate workbook it does not come across.

Thanks

Andi
 
Back
Top