View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default Macro to make a cell work like a check

Try the following:
1) Place a rectangle from the Drawing toolbar over the
cell. Ensure that the top left corner of the rectangle
does not go beyond the cell boundary.
2) Right click the rectangle and select Format Autoshape.
3) Select the Colors and Lines tab.
4) Select No Fill and No Line from the Colors and Lines
menu. It should appear invisible.
5) Right click the rectangle again and select Assign Macro.
6) Assign the following macro to the rectangle.

Sub CheckBoxCells()
Dim C As Range
Set C = ActiveSheet.Shapes(Application.Caller).TopLeftCell
If C.Value = "X" Then C.Value = "" Else C.Value = "X"
End Sub

Note that if you change your mind about the "X" you can
make it a check mark by formating the cell font
as "Marlett" and substituting the lower case "a" for
the "X" in the code. Alternatively, the lower case "h"
will toggle as a large square (bullet).

Regards,
Greg

-----Original Message-----
I'm very new to macro part of Excel.
I have created a number of boxes (cells with borders) in
basic forms that a made.
I was wondering if there is a way to write a macro too
make the boxes work like a check box, but have an 'X'

show
up in it rather than a check, when it is clicked?
.