ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing macro buttons from part of a sheet (https://www.excelbanter.com/excel-programming/279134-removing-macro-buttons-part-sheet.html)

Tim Childs

Removing macro buttons from part of a sheet
 
Hi

the redoubtable DP (very helpfully) gave me this code to remove all
the buttons from a spreadsheet. In reality I want to restrict the
removal to buttons in Column A only. (there are 100+). Alternatively,
I want to remove all the buttons except for one in Column C. It may
sound odd but it is true!

Please can someone give me a start on revising the code

Thanks

Tim

Set CurWks = ActiveSheet

With CurWks
'Suppressed as it deletes the clear clipboard button
'.buttons.delete

Don Guillett[_4_]

Removing macro buttons from part of a sheet
 
Name the one in col C and remove all except that name

"Tim Childs" wrote in message
om...
Hi

the redoubtable DP (very helpfully) gave me this code to remove all
the buttons from a spreadsheet. In reality I want to restrict the
removal to buttons in Column A only. (there are 100+). Alternatively,
I want to remove all the buttons except for one in Column C. It may
sound odd but it is true!

Please can someone give me a start on revising the code

Thanks

Tim

Set CurWks = ActiveSheet

With CurWks
'Suppressed as it deletes the clear clipboard button
'.buttons.delete




Tim Childs

Removing macro buttons from part of a sheet
 
Hi Don

Thanks for the post

Any chance of a bit more detail on the code too control
that deletion

Regards

Tim


-----Original Message-----
Name the one in col C and remove all except that name

"Tim Childs" wrote in message
. com...
Hi

the redoubtable DP (very helpfully) gave me this code

to remove all
the buttons from a spreadsheet. In reality I want to

restrict the
removal to buttons in Column A only. (there are 100+).

Alternatively,
I want to remove all the buttons except for one in

Column C. It may
sound odd but it is true!

Please can someone give me a start on revising the code

Thanks

Tim

Set CurWks = ActiveSheet

With CurWks
'Suppressed as it deletes the clear clipboard

button
'.buttons.delete



.


Debra Dalgleish

Removing macro buttons from part of a sheet
 
The following code deletes buttons in columns other than C:

Sub ClearButtons()
Dim CurWks As Worksheet
Dim btn As Button
Set CurWks = ActiveSheet

For Each btn In CurWks.Buttons
If btn.TopLeftCell.Column < 3 Then
btn.Delete
End If
Next
End Sub


Tim Childs wrote:
Hi Don

Thanks for the post

Any chance of a bit more detail on the code too control
that deletion

Regards

Tim



-----Original Message-----
Name the one in col C and remove all except that name

"Tim Childs" wrote in message
.com...

Hi

the redoubtable DP (very helpfully) gave me this code


to remove all

the buttons from a spreadsheet. In reality I want to


restrict the

removal to buttons in Column A only. (there are 100+).


Alternatively,

I want to remove all the buttons except for one in


Column C. It may

sound odd but it is true!

Please can someone give me a start on revising the code

Thanks

Tim

Set CurWks = ActiveSheet

With CurWks
'Suppressed as it deletes the clear clipboard


button

'.buttons.delete



.




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


Tim Childs

Removing macro buttons from part of a sheet
 
Hi

just the ticket!

THANKS

Tim

-----Original Message-----
The following code deletes buttons in columns other than

C:

Sub ClearButtons()
Dim CurWks As Worksheet
Dim btn As Button
Set CurWks = ActiveSheet

For Each btn In CurWks.Buttons
If btn.TopLeftCell.Column < 3 Then
btn.Delete
End If
Next
End Sub




All times are GMT +1. The time now is 12:18 AM.

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