Thread
:
Checkbox Help
View Single Post
#
6
Posted to microsoft.public.excel.programming
Dave Peterson[_5_]
external usenet poster
Posts: 1,758
Checkbox Help
I put a buttons from the Forms toolbar on the worksheet with the checkboxes from
the Forms toolbar.
I assigned this macro to that button.
Option Explicit
Sub testme()
Dim CBX As CheckBox
For Each CBX In ActiveSheet.CheckBoxes
CBX.Value = xlOn
Next CBX
End Sub
(Why bother checking to see what the value is if you're going to make it xlOn
anyway?)
wrote:
I have tried all of the above and still not working. I am using the
checkboxes from the the Forms toolbar.
and what i want is once i click on a command button i want it to check
if the checkbox has been checked if not then i want to check it but i
want to do all of this with code and not have to maunally check the
box. is this possible in VBA or no becuase i tried the following code:
and it doesnt check the box??? what am i doing wrong???
If Worksheets("Brick").CheckBoxes("Check Box 1").Value = 1 Then
Debug.Print "checked"
Else
Debug.Print "unchecked"
End If
Chip Pearson wrote:
If your checkboxes are from the Controls toolbar, use
Private Sub CommandButton1_Click()
If Sheet1.CheckBox1.Value Then
Debug.Print "checked"
Else
Debug.Print "unchecked"
End If
End Sub
If the checkboxes are from the Forms toolbar, use
If Worksheets("Sheet1").CheckBoxes("Check Box 3").Value = 1 Then
Debug.Print "checked"
Else
Debug.Print "unchecked"
End If
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
wrote in message
oups.com...
Is there a way in code to check a checkbox on an excel
spreadsheet when
a command button is clicked? i tried the following but it didnt
seem to
work: it gave an error saying "Object required"??
Sub SendAll_Click ()
If CheckBox1.Value = 0 then
CheckBox1.Value = 1
End if
End Sub
Any ideas on what i am may be doing wrong???
--
Dave Peterson
Reply With Quote
Dave Peterson[_5_]
View Public Profile
Find all posts by Dave Peterson[_5_]