#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Check for "CheckBox"

I have a Uerform that has "CheckBoxes" and I would like to check and see
which is true so I can enter some data into a cell. The check boxes are
listed as SunCheckbox, MonCheckBox, and so on. The example I am sending is
just a simple example and the letter "n" is to repersent the check box name.

Example:
For c = 1 to 7
n = Format(c, "ddd") & "CheckBox"
If n = True Then Activecell.Offset(0, c+1) = 1
Next c

I hope you can understand what I am trying to do.

Thanks,

ek
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Check for "CheckBox"

Option Explicit
Private Sub CommandButton1_Click()
Dim CBXCtr As Long
Dim CBXName As String
For CBXCtr = 1 To 7
CBXName = Format(CBXCtr, "ddd") & "CheckBox"

If Me.Controls(CBXName).Value = True Then
ActiveCell.Offset(0, CBXCtr + 1).Value = 1
Else
'shouldn't you have this, too?
'ActiveCell.Offset(0, CBXCtr + 1).Value = 0
End If
Next CBXCtr
End Sub

ekreider wrote:

I have a Uerform that has "CheckBoxes" and I would like to check and see
which is true so I can enter some data into a cell. The check boxes are
listed as SunCheckbox, MonCheckBox, and so on. The example I am sending is
just a simple example and the letter "n" is to repersent the check box name.

Example:
For c = 1 to 7
n = Format(c, "ddd") & "CheckBox"
If n = True Then Activecell.Offset(0, c+1) = 1
Next c

I hope you can understand what I am trying to do.

Thanks,

ek


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Check for "CheckBox"

Dave,

Thanks for the help I knew it was simple but I just couldn't get the right
combonation. There is more to the code then what I wrote I just needed to
check to see if the check box was true.

Thank you verry much,

ek

"Dave Peterson" wrote:

Option Explicit
Private Sub CommandButton1_Click()
Dim CBXCtr As Long
Dim CBXName As String
For CBXCtr = 1 To 7
CBXName = Format(CBXCtr, "ddd") & "CheckBox"

If Me.Controls(CBXName).Value = True Then
ActiveCell.Offset(0, CBXCtr + 1).Value = 1
Else
'shouldn't you have this, too?
'ActiveCell.Offset(0, CBXCtr + 1).Value = 0
End If
Next CBXCtr
End Sub

ekreider wrote:

I have a Uerform that has "CheckBoxes" and I would like to check and see
which is true so I can enter some data into a cell. The check boxes are
listed as SunCheckbox, MonCheckBox, and so on. The example I am sending is
just a simple example and the letter "n" is to repersent the check box name.

Example:
For c = 1 to 7
n = Format(c, "ddd") & "CheckBox"
If n = True Then Activecell.Offset(0, c+1) = 1
Next c

I hope you can understand what I am trying to do.

Thanks,

ek


--

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
when a "check box" is checked, a "result" to be shown in another c Lisa Ann Kashner Excel Discussion (Misc queries) 2 November 6th 07 01:32 AM
Check if cells contain the word "Thailand", return "TRUE" ali Excel Worksheet Functions 7 September 14th 07 09:53 AM
how to make a checkbox usable for users to "check" it? Brit Excel Discussion (Misc queries) 3 November 11th 06 08:24 PM
How can I check the "P" or "A" in the attendance sheet Capricorn Excel Worksheet Functions 1 June 8th 06 12:00 PM
create links to check boxes marked "good" fair"and "bad" pjb Excel Worksheet Functions 3 April 20th 06 02:17 AM


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