ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check boxes (https://www.excelbanter.com/excel-programming/309699-check-boxes.html)

gareth

check boxes
 
I have several check boxes on a sheet. I want to check
these boxes and return a 'Y' if it has been selected and
a 'N' if it hasn't.

Thanks in advance.

gareth

Tom Ogilvy

check boxes
 
What kind of checkboxes. ActiveX from the control toolbox toolbar or excel
checkboxes from the forms toolbar. When do you want them to return Y or N?
When the control is checked. If so, then without code, link the checkboxes
to the cell over which they are located and which will contain True or
False. Then in another cell, put in a formula like =if(b9,"Y","N") where
B9 is the linked cell.

Otherwise you would need to not linke the checkbox and use event code to
place the Y or N in the cell.

--
Regards,
Tom Ogilvy

"gareth" wrote in message
...
I have several check boxes on a sheet. I want to check
these boxes and return a 'Y' if it has been selected and
a 'N' if it hasn't.

Thanks in advance.

gareth




gareth

check boxes
 
From the Forms toolbar.

I want to return a 'Y' or a 'N' in a macro. Should I link
the cells and do it that way or is there another way?

gareth
-----Original Message-----
What kind of checkboxes. ActiveX from the control

toolbox toolbar or excel
checkboxes from the forms toolbar. When do you want them

to return Y or N?
When the control is checked. If so, then without code,

link the checkboxes
to the cell over which they are located and which will

contain True or
False. Then in another cell, put in a formula like =if

(b9,"Y","N") where
B9 is the linked cell.

Otherwise you would need to not linke the checkbox and

use event code to
place the Y or N in the cell.

--
Regards,
Tom Ogilvy

"gareth" wrote in

message
...
I have several check boxes on a sheet. I want to check
these boxes and return a 'Y' if it has been selected and
a 'N' if it hasn't.

Thanks in advance.

gareth



.


Tom Ogilvy

check boxes
 
Public Sub Btn_click()
Dim sName As String, cbx As CheckBox
Dim rng As Range
sName = Application.Caller
Set cbx = ActiveSheet.CheckBoxes(sName)
Set rng = cbx.TopLeftCell.Offset(0, -1)
If cbx = xlOn Then
rng.Value = "Y"
Else
rng.Value = "N"
End If
End Sub

Assign this to all your checkboxes. It puts Y or N to the cell to the left
of the cell with the checkbox over it.

Or adjust it to fit you needs.

--
Regards,
Tom Ogilvy

"gareth" wrote in message
...
From the Forms toolbar.

I want to return a 'Y' or a 'N' in a macro. Should I link
the cells and do it that way or is there another way?

gareth
-----Original Message-----
What kind of checkboxes. ActiveX from the control

toolbox toolbar or excel
checkboxes from the forms toolbar. When do you want them

to return Y or N?
When the control is checked. If so, then without code,

link the checkboxes
to the cell over which they are located and which will

contain True or
False. Then in another cell, put in a formula like =if

(b9,"Y","N") where
B9 is the linked cell.

Otherwise you would need to not linke the checkbox and

use event code to
place the Y or N in the cell.

--
Regards,
Tom Ogilvy

"gareth" wrote in

message
...
I have several check boxes on a sheet. I want to check
these boxes and return a 'Y' if it has been selected and
a 'N' if it hasn't.

Thanks in advance.

gareth



.





All times are GMT +1. The time now is 02:45 AM.

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