ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing Checkboxes Programmatically (https://www.excelbanter.com/excel-programming/280095-removing-checkboxes-programmatically.html)

Mark D'Agosta

Removing Checkboxes Programmatically
 
Does anyone know how to remove checkboxes programmatically? These
checkboxes were added programmatically using the
"ActiveSheet.Checkboxes.Add..." syntax. Unfortunately
"ActiveSheet.Checkboxes.Remove..." generates a snytax error.

Someone in this newsgroup advised me of the Checkboxes.Add method, but I'm
unable to find any information on methods of adding or removing userform
controls in on-line help or from any other source. Are there some decent
sources of information that anyone knows of?

Thanks,
Mark D.



Vasant Nanavati

Removing Checkboxes Programmatically
 
Hi Mark:

ActiveSheet.CheckBoxes.Delete

will remove all checkboxes on the sheet.

Regards,

Vasant.

"Mark D'Agosta" wrote in message
et...
Does anyone know how to remove checkboxes programmatically? These
checkboxes were added programmatically using the
"ActiveSheet.Checkboxes.Add..." syntax. Unfortunately
"ActiveSheet.Checkboxes.Remove..." generates a snytax error.

Someone in this newsgroup advised me of the Checkboxes.Add method, but I'm
unable to find any information on methods of adding or removing userform
controls in on-line help or from any other source. Are there some

decent
sources of information that anyone knows of?

Thanks,
Mark D.





Tom Ogilvy

Removing Checkboxes Programmatically
 
Activesheet.Checkboxes.Delete

removes them all

Dim i as Long
Dim cbox as checkbox
i = 0
for each cbox in Activesheet.Checkboxes
i = i + 1
if i mod 2 = 0 then
cbox.delete
end if
Next

will delete every other one (as an example).

--
Regards,
Tom Ogilvy

Mark D'Agosta wrote in message
et...
Does anyone know how to remove checkboxes programmatically? These
checkboxes were added programmatically using the
"ActiveSheet.Checkboxes.Add..." syntax. Unfortunately
"ActiveSheet.Checkboxes.Remove..." generates a snytax error.

Someone in this newsgroup advised me of the Checkboxes.Add method, but I'm
unable to find any information on methods of adding or removing userform
controls in on-line help or from any other source. Are there some

decent
sources of information that anyone knows of?

Thanks,
Mark D.





Mark D'Agosta

Removing Checkboxes Programmatically
 
Thanks for the info on the Checkboxes.Delete method. It works just fine.
As to the second part of my question, where is this stuff documented? The
"Checkboxes" collection does not appear in the member autolist for the
worksheet object; it does not appear in the object browser under the
worksheet object; it's not in the VBA on-line help. Any ideas?

Thanks,
Mark D.



Tom Ogilvy

Removing Checkboxes Programmatically
 
The controls are from xl5/xl95 and are maintained for consistency. Get a
copy of xl5 or xl95 and look at the help file and object browser for
documentation. You can go to the object browser and right click in a blank
area and select show hidden members and you will see the properties and
methods for the checkbox object and checkboxes collection.

I can send you a large word document that contains some good documentation
on them in the context of dialog sheets, but it pretty much equally
applicable to their use on worksheets. Contact me if you want me to send it
to you. The email I am using is a good email. Provide me with a good email
to sent it to.

--
Regards,
Tom Ogilvy


"Mark D'Agosta" wrote in message
t...
Thanks for the info on the Checkboxes.Delete method. It works just fine.
As to the second part of my question, where is this stuff documented? The
"Checkboxes" collection does not appear in the member autolist for the
worksheet object; it does not appear in the object browser under the
worksheet object; it's not in the VBA on-line help. Any ideas?

Thanks,
Mark D.






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com