Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Adding a Checkbox in Cells
Excel 2003. I know how to drag a checkbox from the control tool box onto a
sheet. What I really need (or want) to do is have every cell in a particular column be a checkbox. How may I accomplish this? Thanks and God bless. -- Dr. Doug Pruiett Good News Jail & Prison Ministry www.goodnewsjail.org |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Adding a Checkbox in Cells
Hi Chaplain Doug,
What I really need (or want) to do is have every cell in a particular column be a checkbox. How may I accomplish this? Using VBA, try: '============= Sub InsertCheckBoxes() Dim rng As Range Dim c As Range Set rng = Range("A1:A20") '<<====== CHANGE Application.ScreenUpdating = False For Each c In rng.Cells With ActiveSheet.CheckBoxes.Add(c.Left _ + 5, c.Top - 2, 5, 5) .Caption = "" .LinkedCell = c.Address(False, False) End With c.Font.Color = vbWhite Next c Application.ScreenUpdating = True End Sub '<<============= Change ("A1:A20") to your range of interest. If you are not faniliar with macros, you may wish to visit David McRitchie's 'Getting Started With Macros And User Defined Functions' at: http://www.mvps.org/dmcritchie/excel/getstarted.htm --- Regards, Norman |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Adding a Checkbox in Cells
Thanks Norman. Another question. Once I have these checkboxes in place, may
I reference their value as I do with other cells? That is, ThisWorkBook.ActiveSheet.Cells(row, col).value -- Dr. Doug Pruiett Good News Jail & Prison Ministry www.goodnewsjail.org "Norman Jones" wrote: Hi Chaplain Doug, What I really need (or want) to do is have every cell in a particular column be a checkbox. How may I accomplish this? Using VBA, try: '============= Sub InsertCheckBoxes() Dim rng As Range Dim c As Range Set rng = Range("A1:A20") '<<====== CHANGE Application.ScreenUpdating = False For Each c In rng.Cells With ActiveSheet.CheckBoxes.Add(c.Left _ + 5, c.Top - 2, 5, 5) .Caption = "" .LinkedCell = c.Address(False, False) End With c.Font.Color = vbWhite Next c Application.ScreenUpdating = True End Sub '<<============= Change ("A1:A20") to your range of interest. If you are not faniliar with macros, you may wish to visit David McRitchie's 'Getting Started With Macros And User Defined Functions' at: http://www.mvps.org/dmcritchie/excel/getstarted.htm --- Regards, Norman |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Adding a Checkbox in Cells
You could refer to the linked cell (true/false) (under the checkbox if you used
Norman's code). Or you could just refer to the checkbox value itself. if Activesheet.checkboxes("check box 1").value = xlon then 'checked else 'not checked end if Chaplain Doug wrote: Thanks Norman. Another question. Once I have these checkboxes in place, may I reference their value as I do with other cells? That is, ThisWorkBook.ActiveSheet.Cells(row, col).value -- Dr. Doug Pruiett Good News Jail & Prison Ministry www.goodnewsjail.org "Norman Jones" wrote: Hi Chaplain Doug, What I really need (or want) to do is have every cell in a particular column be a checkbox. How may I accomplish this? Using VBA, try: '============= Sub InsertCheckBoxes() Dim rng As Range Dim c As Range Set rng = Range("A1:A20") '<<====== CHANGE Application.ScreenUpdating = False For Each c In rng.Cells With ActiveSheet.CheckBoxes.Add(c.Left _ + 5, c.Top - 2, 5, 5) .Caption = "" .LinkedCell = c.Address(False, False) End With c.Font.Color = vbWhite Next c Application.ScreenUpdating = True End Sub '<<============= Change ("A1:A20") to your range of interest. If you are not faniliar with macros, you may wish to visit David McRitchie's 'Getting Started With Macros And User Defined Functions' at: http://www.mvps.org/dmcritchie/excel/getstarted.htm --- Regards, Norman -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding cells with the same color, sub works but function doesnt | Excel Discussion (Misc queries) | |||
Adding same cells across multiple worksheets | Excel Worksheet Functions | |||
cells adding problem | New Users to Excel | |||
Adding contents of cells by clicking in Excel 2002 | Excel Discussion (Misc queries) | |||
ADDING CELLS WHICH ARE <> THAN OTHER CELLS | Excel Worksheet Functions |