Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Refeencing a check box on an Excel sheet

I have added a check box control to a sheet in Excel and am trying to check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the correct
syntax for this..

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Refeencing a check box on an Excel sheet

activesheet.checkboxes("Check Box 95").value

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jayklmno" wrote in message
...
I have added a check box control to a sheet in Excel and am trying to

check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the correct
syntax for this..

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Refeencing a check box on an Excel sheet

Depends where you got the check box from. If it came from the control toolbox
then your code should work (you may need to reference the worksheet irf you
are trying to access the checbox from code anywhere other than the sheet that
has the checkbox. If the check box came from the forms toolbar then you need
fairly different code. Give this a try... It was created by starting with a
brand new work book and placing a control from both the forms toolbar and the
control toolbox on sheet 1...

Sub Test
MsgBox Sheet1.CheckBox1.Value 'control toolbox
'Forms Toolbar
MsgBox Sheet1.Shapes("Check Box 1").ControlFormat.Value < xlOff
End Sub

--
HTH...

Jim Thomlinson


"jayklmno" wrote:

I have added a check box control to a sheet in Excel and am trying to check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the correct
syntax for this..

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Refeencing a check box on an Excel sheet

Geez I was trying to get that to work but it just would not go for some
reason... Now that I see yours I realize I was spelling checkboxs not
checkboxes (missing the e)... I am chalking that one up to sleep
deprivation...

Note to the OP that the checkbox from the forms toolbar does not return true
and false by default. It returns a long which is either xlOn, xlOff and one
other (mixed I believe) so you may need to coerce the returned value into
something more useful...

if activesheet.checkboxes("Check Box 95").Value = xlOn then
msgbox "Check Box 95 is checked"
end if
--
HTH...

Jim Thomlinson


"Bob Phillips" wrote:

activesheet.checkboxes("Check Box 95").value

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jayklmno" wrote in message
...
I have added a check box control to a sheet in Excel and am trying to

check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the correct
syntax for this..

Thanks!




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Refeencing a check box on an Excel sheet

That doesn't bomb out with an error, but it also isn't pulling the correct
value. It's pulling a 1. Shouldn't the checkbox value be true or false
whether it's checked or not?

"Bob Phillips" wrote:

activesheet.checkboxes("Check Box 95").value

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jayklmno" wrote in message
...
I have added a check box control to a sheet in Excel and am trying to

check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the correct
syntax for this..

Thanks!






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Refeencing a check box on an Excel sheet

Okay... I got it from here... thanks!

"Jim Thomlinson" wrote:

Depends where you got the check box from. If it came from the control toolbox
then your code should work (you may need to reference the worksheet irf you
are trying to access the checbox from code anywhere other than the sheet that
has the checkbox. If the check box came from the forms toolbar then you need
fairly different code. Give this a try... It was created by starting with a
brand new work book and placing a control from both the forms toolbar and the
control toolbox on sheet 1...

Sub Test
MsgBox Sheet1.CheckBox1.Value 'control toolbox
'Forms Toolbar
MsgBox Sheet1.Shapes("Check Box 1").ControlFormat.Value < xlOff
End Sub

--
HTH...

Jim Thomlinson


"jayklmno" wrote:

I have added a check box control to a sheet in Excel and am trying to check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the correct
syntax for this..

Thanks!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Refeencing a check box on an Excel sheet

No, see Jim's response.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jayklmno" wrote in message
...
That doesn't bomb out with an error, but it also isn't pulling the correct
value. It's pulling a 1. Shouldn't the checkbox value be true or false
whether it's checked or not?

"Bob Phillips" wrote:

activesheet.checkboxes("Check Box 95").value

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jayklmno" wrote in message
...
I have added a check box control to a sheet in Excel and am trying to

check
that box for it's true/false value. How do I find out the name of the
control? I see Excel named it Check Box 95, but I can't get it to

refernce
the value...

if checkbox95 = true then...

doesn't work, or when I refernce the sheet directly. What is the

correct
syntax for this..

Thanks!






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
get rid of check box in excel spread sheet wvgoldwing Excel Discussion (Misc queries) 1 October 20th 08 03:55 AM
How to check if an excel sheet has external references. Daffo Excel Discussion (Misc queries) 3 August 16th 06 06:31 AM
How do I use 1 excel sheet to check another? Pawan Excel Discussion (Misc queries) 3 August 14th 06 08:33 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
create a housekeeping check sheet on excel beginner500 New Users to Excel 2 April 24th 05 12:55 AM


All times are GMT +1. The time now is 10:58 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"