R
ranswert
I am trying to write a program to add checkboxes and delete certain
checkboxes in a row. How do I delete certain checkboxes.
Thanks
checkboxes in a row. How do I delete certain checkboxes.
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
sebastienm said:Hi,
It depends on the type of checkboxes. Are they controls from the Forms
toolbar or from the Control Toolbox toolbar.
In the first case:
Dim wsh As Worksheet
Set wsh = ActiveSheet
wsh.CheckBoxes("Check Box 3").Delete ''' by name
wsh.CheckBoxes(1).Delete ''' by index
In the second case
Dim wsh As Worksheet
Set wsh = ActiveSheet
wsh.OLEObjects("CheckBox1").Delete ''' by name
wsh.OLEObjects(1).Delete ''' by index
--
Regards,
Sébastien
<http://www.ondemandanalysis.com>
<http://www.ready-reports.com>
sebastienm said:You need to know its name or index.
In your code, it seems like a chekbox is associated to a specific row (1
checkbox per row), am i correct?
In that case, you could give it the name "CheckboxRow" & Activecell.Row
i.e.
ActiveSheet.CheckBoxes.Add(40, 138 + (ActiveCell.Value * 12.75), 93,
17.25).Select
Selection.Characters.Text = "Add to Estimate"
selection.name = "CheckboxRow" & activecell.row ''' <<<<<<<<<
ActiveCell.Offset(0, 2).Select
Now when you want to delete the check box in row 14, you can write:
ActiveSheet.CheckBoxes("CheckboxRow" & activecell.row).Delete
Would that work?
--
Regards,
Sébastien
<http://www.ondemandanalysis.com>
<http://www.ready-reports.com>
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.