Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to make a cell work like a check
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to make a cell work like a check
It took me a couple minutes to figure it out but I got it
to work(very new at this). I wasn't naming the macro "CheckBoxCells". I think that me work for me. Thnks for your help Greg -----Original Message----- 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? . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
make a check form, and then have info go to a check register | Excel Worksheet Functions | |||
Make them work on the Each cell Value | Excel Worksheet Functions | |||
How do I make the check mark boc bigger on the check box? | Excel Discussion (Misc queries) | |||
Make table query will work in datasheet view but will not make tab | Excel Discussion (Misc queries) | |||
How can i make this work within an IF statement: (41<=Cell<=46) | New Users to Excel |