Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Clear check box macro

In an excel program, I have set up a command button that will automatically
clear out the information in certain cells. My problem is that within my
excell document I have some check boxes. I want to set my macro up so that
it will also look at my check boxes and if the box is checked, I want it to
uncheck it and if it is unchecked I want it to leave it alone. Can someone
help me??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Clear check box macro

Hi Kyla, If your CheckBox's are in a userform and also believe on a
worksheet. You can us this code to clear all the checkbox's.

enjoy, Rick , FBKS, AK


Dim ctrl as Control

With Me
For Each ctrl In .Controls
if TypeName(ctrl) ="CheckBox" then
ctrl.value = False
endif
next ctrl

End With

"Kyla Dockery" wrote in message
...
In an excel program, I have set up a command button that will

automatically
clear out the information in certain cells. My problem is that within my
excell document I have some check boxes. I want to set my macro up so

that
it will also look at my check boxes and if the box is checked, I want it

to
uncheck it and if it is unchecked I want it to leave it alone. Can

someone
help me??



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Clear check box macro

Probably the easiest way is to link the value of the checkbox to a cell and
then just change the value of the cell to false...

If your checkbox is from the forms toolbar then right click the box and
select Format Control and then on the Control tab Add a cell to link to.

If your checkbox is from the control toolbox put the sheet in design mode by
hitting the Design mode button on the toolbar. Then right click the check box
and select properties. Add a reference to the linked cell property.
--
HTH...

Jim Thomlinson


"Kyla Dockery" wrote:

In an excel program, I have set up a command button that will automatically
clear out the information in certain cells. My problem is that within my
excell document I have some check boxes. I want to set my macro up so that
it will also look at my check boxes and if the box is checked, I want it to
uncheck it and if it is unchecked I want it to leave it alone. Can someone
help me??

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Clear check box macro

Hi Rick.

Thank you for responding to my email. I am having a problem with the code
you gave me though. When I compile my VBAProject it give me this error:

Compile Error:
Method or Data Member not Found

Also, should I be subsistuting another word for TypeName? If so what should
go here?

"Rick Hansen" wrote:

Hi Kyla, If your CheckBox's are in a userform and also believe on a
worksheet. You can us this code to clear all the checkbox's.

enjoy, Rick , FBKS, AK


Dim ctrl as Control

With Me
For Each ctrl In .Controls
if TypeName(ctrl) ="CheckBox" then
ctrl.value = False
endif
next ctrl

End With

"Kyla Dockery" wrote in message
...
In an excel program, I have set up a command button that will

automatically
clear out the information in certain cells. My problem is that within my
excell document I have some check boxes. I want to set my macro up so

that
it will also look at my check boxes and if the box is checked, I want it

to
uncheck it and if it is unchecked I want it to leave it alone. Can

someone
help me??




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Clear check box macro

Kyla, What type of Checkbox's are you using? Form Control or Control
toolbox. And whwere are your checkboxs localed at ?. I'll check with you
later, have go to work..

later Rick



"Kyla Dockery" wrote in message
...
Hi Rick.

Thank you for responding to my email. I am having a problem with the code
you gave me though. When I compile my VBAProject it give me this error:

Compile Error:
Method or Data Member not Found

Also, should I be subsistuting another word for TypeName? If so what

should
go here?

"Rick Hansen" wrote:

Hi Kyla, If your CheckBox's are in a userform and also believe on a
worksheet. You can us this code to clear all the checkbox's.

enjoy, Rick , FBKS, AK


Dim ctrl as Control

With Me
For Each ctrl In .Controls
if TypeName(ctrl) ="CheckBox" then
ctrl.value = False
endif
next ctrl

End With

"Kyla Dockery" wrote in message
...
In an excel program, I have set up a command button that will

automatically
clear out the information in certain cells. My problem is that within

my
excell document I have some check boxes. I want to set my macro up so

that
it will also look at my check boxes and if the box is checked, I want

it
to
uncheck it and if it is unchecked I want it to leave it alone. Can

someone
help me??








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Clear check box macro

Hey Rick,

My check boxes were chosen from the Control toolbox, and they are located in
an excel spreadsheet, not on a form. I need to know exactly how to
incorporate the clear check box code with my existing code that clears the
other fields. I created a button on my spreadsheet named Clear Kronos Page
and in View Code wrote the macro to clear out the identified info. Here is
my existing code:

Private Sub CommandButton1_Click()

' KronosClear Macro
' Macro recorded 4/26/2006 by kdockery
'
' Keyboard Shortcut: Ctrl+k
'
Range("A6:D18").Select
Selection.ClearContents
Range("E6:F18").Select
Selection.ClearContents
Range("G6:H18").Select
Selection.ClearContents
Range("J6:L18").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=7
Range("A23:I41").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-20
Range("A6").Select
End Sub

I hope this helps!

Kyla Dockery

"Rick Hansen" wrote:

Kyla, What type of Checkbox's are you using? Form Control or Control
toolbox. And whwere are your checkboxs localed at ?. I'll check with you
later, have go to work..

later Rick



"Kyla Dockery" wrote in message
...
Hi Rick.

Thank you for responding to my email. I am having a problem with the code
you gave me though. When I compile my VBAProject it give me this error:

Compile Error:
Method or Data Member not Found

Also, should I be subsistuting another word for TypeName? If so what

should
go here?

"Rick Hansen" wrote:

Hi Kyla, If your CheckBox's are in a userform and also believe on a
worksheet. You can us this code to clear all the checkbox's.

enjoy, Rick , FBKS, AK


Dim ctrl as Control

With Me
For Each ctrl In .Controls
if TypeName(ctrl) ="CheckBox" then
ctrl.value = False
endif
next ctrl

End With

"Kyla Dockery" wrote in message
...
In an excel program, I have set up a command button that will
automatically
clear out the information in certain cells. My problem is that within

my
excell document I have some check boxes. I want to set my macro up so
that
it will also look at my check boxes and if the box is checked, I want

it
to
uncheck it and if it is unchecked I want it to leave it alone. Can
someone
help me??






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Clear check box macro

Hey Rick,

I finally kept messing around with my code until I figured out what I needed
to do. It all works beautifully now! Thank you so much for the help you
gave me earlier.

Kyla

"Kyla Dockery" wrote:

In an excel program, I have set up a command button that will automatically
clear out the information in certain cells. My problem is that within my
excell document I have some check boxes. I want to set my macro up so that
it will also look at my check boxes and if the box is checked, I want it to
uncheck it and if it is unchecked I want it to leave it alone. Can someone
help me??

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Clear check box macro

Hey Kyla, Your very welcome. I'm glad I could help..

enjoy Rick (Fbks, Ak)



"Kyla Dockery" wrote in message
...
Hey Rick,

I finally kept messing around with my code until I figured out what I

needed
to do. It all works beautifully now! Thank you so much for the help you
gave me earlier.

Kyla

"Kyla Dockery" wrote:

In an excel program, I have set up a command button that will

automatically
clear out the information in certain cells. My problem is that within

my
excell document I have some check boxes. I want to set my macro up so

that
it will also look at my check boxes and if the box is checked, I want it

to
uncheck it and if it is unchecked I want it to leave it alone. Can

someone
help me??



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear check box macro

I am having a similar issue. Could you send me a copy of your complete code
that deletes data and unchecks boxes?

"Kyla Dockery" wrote:

Hey Rick,

My check boxes were chosen from the Control toolbox, and they are located in
an excel spreadsheet, not on a form. I need to know exactly how to
incorporate the clear check box code with my existing code that clears the
other fields. I created a button on my spreadsheet named Clear Kronos Page
and in View Code wrote the macro to clear out the identified info. Here is
my existing code:

Private Sub CommandButton1_Click()

' KronosClear Macro
' Macro recorded 4/26/2006 by kdockery
'
' Keyboard Shortcut: Ctrl+k
'
Range("A6:D18").Select
Selection.ClearContents
Range("E6:F18").Select
Selection.ClearContents
Range("G6:H18").Select
Selection.ClearContents
Range("J6:L18").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=7
Range("A23:I41").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-20
Range("A6").Select
End Sub

I hope this helps!

Kyla Dockery

"Rick Hansen" wrote:

Kyla, What type of Checkbox's are you using? Form Control or Control
toolbox. And whwere are your checkboxs localed at ?. I'll check with you
later, have go to work..

later Rick



"Kyla Dockery" wrote in message
...
Hi Rick.

Thank you for responding to my email. I am having a problem with the code
you gave me though. When I compile my VBAProject it give me this error:

Compile Error:
Method or Data Member not Found

Also, should I be subsistuting another word for TypeName? If so what

should
go here?

"Rick Hansen" wrote:

Hi Kyla, If your CheckBox's are in a userform and also believe on a
worksheet. You can us this code to clear all the checkbox's.

enjoy, Rick , FBKS, AK


Dim ctrl as Control

With Me
For Each ctrl In .Controls
if TypeName(ctrl) ="CheckBox" then
ctrl.value = False
endif
next ctrl

End With

"Kyla Dockery" wrote in message
...
In an excel program, I have set up a command button that will
automatically
clear out the information in certain cells. My problem is that within

my
excell document I have some check boxes. I want to set my macro up so
that
it will also look at my check boxes and if the box is checked, I want

it
to
uncheck it and if it is unchecked I want it to leave it alone. Can
someone
help me??






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
excel check register template. How to put symbol in clear column billyjpoohbah Excel Discussion (Misc queries) 1 July 26th 07 11:24 PM
Clear contents macro Dave Excel Programming 10 April 6th 06 07:41 PM
Clear Contents Macro SJC Excel Worksheet Functions 3 October 27th 05 07:26 PM
Using a Macro to clear out check box seletions Mel Excel Worksheet Functions 5 May 20th 05 08:35 PM
Help with a Clear Form Macro DangerMouse114[_3_] Excel Programming 2 May 25th 04 07:25 AM


All times are GMT +1. The time now is 02:39 PM.

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"