Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Chaplain Doug
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Chaplain Doug
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding cells with the same color, sub works but function doesnt jerredjohnson Excel Discussion (Misc queries) 1 April 18th 06 08:31 PM
Adding same cells across multiple worksheets LACA Excel Worksheet Functions 2 January 19th 06 03:21 PM
cells adding problem Bentley New Users to Excel 3 December 31st 05 07:04 PM
Adding contents of cells by clicking in Excel 2002 Kevin Gordon Excel Discussion (Misc queries) 7 January 11th 05 04:49 PM
ADDING CELLS WHICH ARE <> THAN OTHER CELLS boogie Excel Worksheet Functions 2 November 25th 04 02:41 PM


All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"