I'd like to be able to press one command button which deletes another command button on a different worksheet - is this possible?
many thanks
I'd like to be able to press one command button which deletes another command button on a different worksheet - is this possible?
many thanks
Attach this to the button macro
Worksheets("Sheet3").Buttons("Button 1").Delete
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"bluegnu" <[email protected]> wrote in
message news:[email protected]...
>
> I'd like to be able to press one command button which deletes another
> command button on a different worksheet - is this possible?
>
> many thanks
>
>
> --
> bluegnu
> ------------------------------------------------------------------------
> bluegnu's Profile:
http://www.excelforum.com/member.php...o&userid=36108
> View this thread: http://www.excelforum.com/showthread...hreadid=559824
>
Thanks for the response.
I get the message "unable to get buttons property of worksheet class" when I press the button. Any idea what I'm doing wrong? I've ensured the button isn't locked or anything.
Hi BlueGnu,
Try:
'=============>>
Private Sub CommandButton1_Click()
Dim MyButton As OLEObject
On Error Resume Next
Set MyButton = ThisWorkbook.Sheets("Sheet2"). _
OLEObjects("Commandbutton5")
On Error GoTo 0
If Not MyButton Is Nothing Then
MyButton.Delete
Else
MsgBox "CommandButton already deleted or not found"
End If
End Sub
'<<=============
---
Regards,
Norman
"bluegnu" <[email protected]> wrote in
message news:[email protected]...
>
> I'd like to be able to press one command button which deletes another
> command button on a different worksheet - is this possible?
>
> many thanks
>
>
> --
> bluegnu
> ------------------------------------------------------------------------
> bluegnu's Profile:
> http://www.excelforum.com/member.php...o&userid=36108
> View this thread: http://www.excelforum.com/showthread...hreadid=559824
>
Is it a control toolbox button?
Worksheets("Sheet3").OleObjects("Button 1").Delete
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"bluegnu" <[email protected]> wrote in
message news:[email protected]...
>
> Thanks for the response.
>
> I get the message "unable to get buttons property of worksheet class"
> when I press the button. Any idea what I'm doing wrong? I've ensured
> the button isn't locked or anything.
>
>
> --
> bluegnu
> ------------------------------------------------------------------------
> bluegnu's Profile:
http://www.excelforum.com/member.php...o&userid=36108
> View this thread: http://www.excelforum.com/showthread...hreadid=559824
>
Thanks very much, they worked well!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks