Macro to clear checkboxes
Sorry for the duplicate posting. Previous posting was answered but solution
does not work and have had no further replies. Is it possible to have a macro that can change all checkboxes that have been set to checked back to €˜unchecked? I need a macro that will clear all of the checks in €˜checkboxes (forms object) on a sheet. The checkboxes are just basic checkboxes beside peoples names and are manually selected (checked) when that person has paid. I would like to be able to reset all of the checkboxes back to unchecked with a macro button. I cant get the auto record macro function to select a forms object. |
Macro to clear checkboxes
Guy,
How you trigger the macro to do this is up to you but this uses a commnd button on your form Private Sub CommandButton1_Click() Dim cCont As Control For Each cCont In Me.Controls If TypeName(cCont) = "CheckBox" Then cCont.Value = False End If Next cCont End Sub Mike "Guy" wrote: Sorry for the duplicate posting. Previous posting was answered but solution does not work and have had no further replies. Is it possible to have a macro that can change all checkboxes that have been set to checked back to €˜unchecked? I need a macro that will clear all of the checks in €˜checkboxes (forms object) on a sheet. The checkboxes are just basic checkboxes beside peoples names and are manually selected (checked) when that person has paid. I would like to be able to reset all of the checkboxes back to unchecked with a macro button. I cant get the auto record macro function to select a forms object. |
Macro to clear checkboxes
Hi Mike,
I am just a novice at this and I can't seem to get this to work. I think I have figured out how to post the code to the command button I put on the sheet but just can't get it to work. I just copied and pasted your code to the command button screen. This is the first time I have tried to use a command button and I am probably just making a simple mistake. Can you help? Guy "Mike H" wrote: Guy, How you trigger the macro to do this is up to you but this uses a commnd button on your form Private Sub CommandButton1_Click() Dim cCont As Control For Each cCont In Me.Controls If TypeName(cCont) = "CheckBox" Then cCont.Value = False End If Next cCont End Sub Mike "Guy" wrote: Sorry for the duplicate posting. Previous posting was answered but solution does not work and have had no further replies. Is it possible to have a macro that can change all checkboxes that have been set to checked back to €˜unchecked? I need a macro that will clear all of the checks in €˜checkboxes (forms object) on a sheet. The checkboxes are just basic checkboxes beside peoples names and are manually selected (checked) when that person has paid. I would like to be able to reset all of the checkboxes back to unchecked with a macro button. I cant get the auto record macro function to select a forms object. |
Macro to clear checkboxes
Guy,
I had assumed you checkboxes were on a userform, if they are on a sheet then put a button on your sheet (You may already have done this) and assign this code to it Dim ws As Worksheet Dim obj As OLEObject Set ws = ActiveSheet For Each obj In ws.OLEObjects If TypeName(obj.Object) = "CheckBox" Then obj.Object.Value = False End If Next obj Mike "Guy" wrote: Hi Mike, I am just a novice at this and I can't seem to get this to work. I think I have figured out how to post the code to the command button I put on the sheet but just can't get it to work. I just copied and pasted your code to the command button screen. This is the first time I have tried to use a command button and I am probably just making a simple mistake. Can you help? Guy "Mike H" wrote: Guy, How you trigger the macro to do this is up to you but this uses a commnd button on your form Private Sub CommandButton1_Click() Dim cCont As Control For Each cCont In Me.Controls If TypeName(cCont) = "CheckBox" Then cCont.Value = False End If Next cCont End Sub Mike "Guy" wrote: Sorry for the duplicate posting. Previous posting was answered but solution does not work and have had no further replies. Is it possible to have a macro that can change all checkboxes that have been set to checked back to €˜unchecked? I need a macro that will clear all of the checks in €˜checkboxes (forms object) on a sheet. The checkboxes are just basic checkboxes beside peoples names and are manually selected (checked) when that person has paid. I would like to be able to reset all of the checkboxes back to unchecked with a macro button. I cant get the auto record macro function to select a forms object. |
Macro to clear checkboxes
If those are checkboxes from the Forms toolbar:
Activesheet.checkboxes.value = xloff Guy wrote: Sorry for the duplicate posting. Previous posting was answered but solution does not work and have had no further replies. Is it possible to have a macro that can change all checkboxes that have been set to checked back to €˜unchecked? I need a macro that will clear all of the checks in €˜checkboxes (forms object) on a sheet. The checkboxes are just basic checkboxes beside peoples names and are manually selected (checked) when that person has paid. I would like to be able to reset all of the checkboxes back to unchecked with a macro button. I cant get the auto record macro function to select a forms object. -- Dave Peterson |
Macro to clear checkboxes
Thanks to everyone,
Ya'll are great! Special thanks to Dave, that is the simplest code I have ever used and works great. Thanks, Guy "Dave Peterson" wrote: If those are checkboxes from the Forms toolbar: Activesheet.checkboxes.value = xloff Guy wrote: Sorry for the duplicate posting. Previous posting was answered but solution does not work and have had no further replies. Is it possible to have a macro that can change all checkboxes that have been set to checked back to €˜unchecked€„¢? I need a macro that will clear all of the checks in €˜checkboxes€„¢ (forms object) on a sheet. The checkboxes are just basic checkboxes beside peoples names and are manually selected (checked) when that person has paid. I would like to be able to reset all of the checkboxes back to unchecked with a macro button. I can€„¢t get the auto record macro function to select a forms object. -- Dave Peterson |
All times are GMT +1. The time now is 06:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com