View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Buttons - Select All ?

This one seems to select CommandButtons only.
Regards,
KL

Sub SelectActiveXButtons()
Dim OLEobj As Excel.OLEObject

ReDim btnsArray(0)
For Each OLEobj In ActiveSheet.OLEObjects
If TypeOf OLEobj.Object Is msforms.CommandButton Then
btnsArray(UBound(btnsArray)) = OLEobj.Name
ReDim Preserve btnsArray(UBound(btnsArray) + 1)
End If
Next OLEobj

If UBound(btnsArray) 0 Then
ReDim Preserve btnsArray(UBound(btnsArray) - 1)
ActiveSheet.Shapes.Range(btnsArray).Select
End If
End Sub


"KL" wrote in message
...
Emory,

You can try the following code, but it will select all Toolbox Controls on
your sheet.

Regards,
KL

Sub SelectAllControlToolboxShapes()
With ActiveSheet.Shapes
numShapes = .Count
If numShapes 1 Then
ReDim btnsArray(0)
For i = 1 To numShapes
If .Item(i).Type = 12 Then
btnsArray(UBound(btnsArray)) = .Item(i).Name
ReDim Preserve btnsArray(UBound(btnsArray) + 1)
End If
Next
If UBound(btnsArray) 0 Then
ReDim Preserve btnsArray(UBound(btnsArray) - 1)
.Range(btnsArray).Select
End If
End If
End With
End Sub

"Emory Richter" wrote in message
om...
Is there a statement to select *all* the buttons on a worksheet
in order to delete them or change their properties as a group?

Thank you,
Emory