Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I want to create check boxes for each row in a column. I was wondering if
there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here's a macro by Dave Peterson.
Sub addCBX() Dim myCBX As CheckBox Dim myCell As Range With ActiveSheet .CheckBoxes.Delete 'nice for testing For Each myCell In ActiveSheet.Range("A2:A10").Cells With myCell Set myCBX = .Parent.CheckBoxes.Add _ (Top:=.Top, Width:=.Width, _ Left:=.Left, Height:=.Height) With myCBX .LinkedCell = myCell.Address(external:=True) .Caption = "" 'or whatever you want .Name = "CBX_" & myCell.Address(0, 0) End With .NumberFormat = ";;;" End With Next myCell End With End Sub Just change the range reference: ("A2:A10") to whatever you want. The macro also sets the linked cell to be the same cell the checkbox is "in" and sets the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no caption. If you want the same caption in every checkbox you'll have to edit that line. If you want a different caption in each checkbox then you'll have to do it manually. Biff "SteveK" wrote in message ... I want to create check boxes for each row in a column. I was wondering if there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
awesome that worked out well. thanks for the help Biff
"Biff" wrote: Here's a macro by Dave Peterson. Sub addCBX() Dim myCBX As CheckBox Dim myCell As Range With ActiveSheet .CheckBoxes.Delete 'nice for testing For Each myCell In ActiveSheet.Range("A2:A10").Cells With myCell Set myCBX = .Parent.CheckBoxes.Add _ (Top:=.Top, Width:=.Width, _ Left:=.Left, Height:=.Height) With myCBX .LinkedCell = myCell.Address(external:=True) .Caption = "" 'or whatever you want .Name = "CBX_" & myCell.Address(0, 0) End With .NumberFormat = ";;;" End With Next myCell End With End Sub Just change the range reference: ("A2:A10") to whatever you want. The macro also sets the linked cell to be the same cell the checkbox is "in" and sets the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no caption. If you want the same caption in every checkbox you'll have to edit that line. If you want a different caption in each checkbox then you'll have to do it manually. Biff "SteveK" wrote in message ... I want to create check boxes for each row in a column. I was wondering if there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
We have Dave Peterson to thank. Thanks for the feedback!
Biff "SteveK" wrote in message ... awesome that worked out well. thanks for the help Biff "Biff" wrote: Here's a macro by Dave Peterson. Sub addCBX() Dim myCBX As CheckBox Dim myCell As Range With ActiveSheet .CheckBoxes.Delete 'nice for testing For Each myCell In ActiveSheet.Range("A2:A10").Cells With myCell Set myCBX = .Parent.CheckBoxes.Add _ (Top:=.Top, Width:=.Width, _ Left:=.Left, Height:=.Height) With myCBX .LinkedCell = myCell.Address(external:=True) .Caption = "" 'or whatever you want .Name = "CBX_" & myCell.Address(0, 0) End With .NumberFormat = ";;;" End With Next myCell End With End Sub Just change the range reference: ("A2:A10") to whatever you want. The macro also sets the linked cell to be the same cell the checkbox is "in" and sets the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no caption. If you want the same caption in every checkbox you'll have to edit that line. If you want a different caption in each checkbox then you'll have to do it manually. Biff "SteveK" wrote in message ... I want to create check boxes for each row in a column. I was wondering if there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Biff,
I used this macro and it worked great, except that by row 130 my checkbox appears in row 129. My row heights are consistent 25.50 or 34 pixels. Is there some adjustment I can make to the macro to correct for this? Thanks! Keith "Biff" wrote: Here's a macro by Dave Peterson. Sub addCBX() Dim myCBX As CheckBox Dim myCell As Range With ActiveSheet .CheckBoxes.Delete 'nice for testing For Each myCell In ActiveSheet.Range("A2:A10").Cells With myCell Set myCBX = .Parent.CheckBoxes.Add _ (Top:=.Top, Width:=.Width, _ Left:=.Left, Height:=.Height) With myCBX .LinkedCell = myCell.Address(external:=True) .Caption = "" 'or whatever you want .Name = "CBX_" & myCell.Address(0, 0) End With .NumberFormat = ";;;" End With Next myCell End With End Sub Just change the range reference: ("A2:A10") to whatever you want. The macro also sets the linked cell to be the same cell the checkbox is "in" and sets the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no caption. If you want the same caption in every checkbox you'll have to edit that line. If you want a different caption in each checkbox then you'll have to do it manually. Biff "SteveK" wrote in message ... I want to create check boxes for each row in a column. I was wondering if there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I've had better luck when the zoom is set to 100%.
Any chance you're not using 100% zoom???? Keith-NB wrote: Biff, I used this macro and it worked great, except that by row 130 my checkbox appears in row 129. My row heights are consistent 25.50 or 34 pixels. Is there some adjustment I can make to the macro to correct for this? Thanks! Keith "Biff" wrote: Here's a macro by Dave Peterson. Sub addCBX() Dim myCBX As CheckBox Dim myCell As Range With ActiveSheet .CheckBoxes.Delete 'nice for testing For Each myCell In ActiveSheet.Range("A2:A10").Cells With myCell Set myCBX = .Parent.CheckBoxes.Add _ (Top:=.Top, Width:=.Width, _ Left:=.Left, Height:=.Height) With myCBX .LinkedCell = myCell.Address(external:=True) .Caption = "" 'or whatever you want .Name = "CBX_" & myCell.Address(0, 0) End With .NumberFormat = ";;;" End With Next myCell End With End Sub Just change the range reference: ("A2:A10") to whatever you want. The macro also sets the linked cell to be the same cell the checkbox is "in" and sets the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no caption. If you want the same caption in every checkbox you'll have to edit that line. If you want a different caption in each checkbox then you'll have to do it manually. Biff "SteveK" wrote in message ... I want to create check boxes for each row in a column. I was wondering if there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave,
That was it. Thanks to you and Biff for the help. Best, Keith "Dave Peterson" wrote: I've had better luck when the zoom is set to 100%. Any chance you're not using 100% zoom???? Keith-NB wrote: Biff, I used this macro and it worked great, except that by row 130 my checkbox appears in row 129. My row heights are consistent 25.50 or 34 pixels. Is there some adjustment I can make to the macro to correct for this? Thanks! Keith "Biff" wrote: Here's a macro by Dave Peterson. Sub addCBX() Dim myCBX As CheckBox Dim myCell As Range With ActiveSheet .CheckBoxes.Delete 'nice for testing For Each myCell In ActiveSheet.Range("A2:A10").Cells With myCell Set myCBX = .Parent.CheckBoxes.Add _ (Top:=.Top, Width:=.Width, _ Left:=.Left, Height:=.Height) With myCBX .LinkedCell = myCell.Address(external:=True) .Caption = "" 'or whatever you want .Name = "CBX_" & myCell.Address(0, 0) End With .NumberFormat = ";;;" End With Next myCell End With End Sub Just change the range reference: ("A2:A10") to whatever you want. The macro also sets the linked cell to be the same cell the checkbox is "in" and sets the checkstate (TRUE or FALSE) to be "invisible". The Caption is set to no caption. If you want the same caption in every checkbox you'll have to edit that line. If you want a different caption in each checkbox then you'll have to do it manually. Biff "SteveK" wrote in message ... I want to create check boxes for each row in a column. I was wondering if there is a way to relate the check box to one cell and maybe drag the bottom right corner down and have it copy down the row. Is there a way to do this or another approach i might be able to use? Thanks ahead of time -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying forumla for vlook up but changing the column Index # | Excel Worksheet Functions | |||
macro | Excel Discussion (Misc queries) | |||
Check COlumn - Excel VBA | Excel Discussion (Misc queries) | |||
match and count words | Excel Worksheet Functions | |||
Return Count for LAST NonBlank Cell in each Row | Excel Worksheet Functions |