ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checkbox Offset (https://www.excelbanter.com/excel-programming/353568-checkbox-offset.html)

Herd

Checkbox Offset
 
I am using the following code to add checkboxes. How can I get the value of
"1" to show up in column "L" if the check box is checked?
thanks fo the help.

Dim myCBX As CheckBox
Dim myCell As Range
Dim r As Integer

With ActiveSheet
.CheckBoxes.Delete
For Each myCell In ActiveSheet.Range("B3:B800").Cells

With myCell
Set myCBX = .Parent.CheckBoxes.Add _
(Top:=.Top, Width:=.Width, _
Left:=.Left, Height:=.Height)
With myCBX
.LinkedCell = myCell.Address(external:=True)
.Caption = ""
.Name = "CBX_" & myCell.Address(0, 0)
End With
.NumberFormat = ";;;"
End With
Next myCell
End With

Norman Jones

Checkbox Offset
 
Hi Herd,

Try replacing:

.LinkedCell = myCell.Address(external:=True)



with

.LinkedCell = myCell.Offset(0, 10).Address(external:=True)


---
Regards,
Norman



"Herd" wrote in message
...
I am using the following code to add checkboxes. How can I get the value
of
"1" to show up in column "L" if the check box is checked?
thanks fo the help.

Dim myCBX As CheckBox
Dim myCell As Range
Dim r As Integer

With ActiveSheet
.CheckBoxes.Delete
For Each myCell In ActiveSheet.Range("B3:B800").Cells

With myCell
Set myCBX = .Parent.CheckBoxes.Add _
(Top:=.Top, Width:=.Width, _
Left:=.Left, Height:=.Height)
With myCBX
.LinkedCell = myCell.Address(external:=True)
.Caption = ""
.Name = "CBX_" & myCell.Address(0, 0)
End With
.NumberFormat = ";;;"
End With
Next myCell
End With




Herd

Checkbox Offset
 
Thank You for the help. It works great.

"Norman Jones" wrote:

Hi Herd,

Try replacing:

.LinkedCell = myCell.Address(external:=True)



with

.LinkedCell = myCell.Offset(0, 10).Address(external:=True)


---
Regards,
Norman



"Herd" wrote in message
...
I am using the following code to add checkboxes. How can I get the value
of
"1" to show up in column "L" if the check box is checked?
thanks fo the help.

Dim myCBX As CheckBox
Dim myCell As Range
Dim r As Integer

With ActiveSheet
.CheckBoxes.Delete
For Each myCell In ActiveSheet.Range("B3:B800").Cells

With myCell
Set myCBX = .Parent.CheckBoxes.Add _
(Top:=.Top, Width:=.Width, _
Left:=.Left, Height:=.Height)
With myCBX
.LinkedCell = myCell.Address(external:=True)
.Caption = ""
.Name = "CBX_" & myCell.Address(0, 0)
End With
.NumberFormat = ";;;"
End With
Next myCell
End With






All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com