Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete check boxes automatically

Currently I'm facing the following difficulty:

I have added several checkboxes in Column A. But if I want to delete
them all, I have to select them one by one, right mouse click and
press <delete

Does someone know a simple way of deleting those checkboxes all in one
action?

Look forward to your reply, thanks in advance,

Johan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Delete check boxes automatically

If they're from the forms toolbar:
activesheet.checkboxes.delete

If they're from the control toolbox toolbar:
Dim myCBX As OLEObject
For Each myCBX In Activesheet.OLEObjects
If TypeOf myCBX.Object Is MSForms.CheckBox Then
myCBX.Delete
End If
Next myCBX

wrote:

Currently I'm facing the following difficulty:

I have added several checkboxes in Column A. But if I want to delete
them all, I have to select them one by one, right mouse click and
press <delete

Does someone know a simple way of deleting those checkboxes all in one
action?

Look forward to your reply, thanks in advance,

Johan


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Delete check boxes automatically

Tnx Dave, but it doesn't work yet.

I use the following Macro to add the checkboxes to a selected area:

Sub chckbxmkr()

On Error Resume Next
Dim c As Range, myRange As Range
Set myRange = Selection
For Each c In myRange.Cells
ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select
With Selection
..LinkedCell = c.Address
..Characters.Text = ""
..Name = c.Address
End With
c.Select
With Selection
..FormatConditions.Delete
..FormatConditions.Add Type:=xlExpression, _
Formula1:="=" & c.Address & "=TRUE"
..FormatConditions(1).Font.ColorIndex = 6 'change for other color when
ticked
..FormatConditions(1).Interior.ColorIndex = 6 'change for other color
when ticked
..Font.ColorIndex = 2 'cell background color = White
End With
Next
myRange.Select
End Sub

But if I run your code I get an error on this:
"TypeOf myCBX.Object Is MSForms.CheckBox"

Can you help out? Tnx again,

Johan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Delete check boxes automatically

You added checkboxes from the Forms toolbar.

Don't use that second suggestion. Use the first.

Johan wrote:

Tnx Dave, but it doesn't work yet.

I use the following Macro to add the checkboxes to a selected area:

Sub chckbxmkr()

On Error Resume Next
Dim c As Range, myRange As Range
Set myRange = Selection
For Each c In myRange.Cells
ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select
With Selection
.LinkedCell = c.Address
.Characters.Text = ""
.Name = c.Address
End With
c.Select
With Selection
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=" & c.Address & "=TRUE"
.FormatConditions(1).Font.ColorIndex = 6 'change for other color when
ticked
.FormatConditions(1).Interior.ColorIndex = 6 'change for other color
when ticked
.Font.ColorIndex = 2 'cell background color = White
End With
Next
myRange.Select
End Sub

But if I run your code I get an error on this:
"TypeOf myCBX.Object Is MSForms.CheckBox"

Can you help out? Tnx again,

Johan


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Delete check boxes automatically

Aaah...I was reading too quickly. It works really good. Thanks for your
nice and quick help!

Johan

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
delete caption on multiple check boxes confused?? Excel Discussion (Misc queries) 2 September 2nd 09 07:56 AM
Delete Check Boxes Karen Excel Discussion (Misc queries) 3 June 18th 08 09:31 PM
delete check boxes Beans Excel Discussion (Misc queries) 2 April 10th 08 07:52 PM
How do I delete an already created series of check boxes? Tony Excel Discussion (Misc queries) 2 July 5th 07 09:52 PM
Macros to delete check boxes GWB Direct Excel Discussion (Misc queries) 23 June 3rd 05 09:56 PM


All times are GMT +1. The time now is 07:04 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"