Hide a macro button

Cuzzaa

Board Regular
Joined
Apr 30, 2019
Messages
86
Hi everyone

Please can anyone give me a hand? I have a macro button that does something, however is there a simple piece of code I can include within this macro that will hide another macro button called 'Export' for example?

If so, is there then also another piece of code I can use to unhide this button when I click on another button?

Is this simple to do?

Many thanks for any help you can provide me
 
Re: Help please - how to hide a macro button

Thanks Sykes.

Yes the button is in the active sheet.

When running that code it returns:

Dashboard Button 13

Does this help?
 
Last edited:
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Re: Help please - how to hide a macro button

It should also have given us a sheet name.
What's the WHOLE string, when that code's run?

The other question I'd asked in my previous post was, "Where is this procedure held?" i.e. in the sheet's code module, in a module, or in "This Workbook"?

New question to add to those two, how many of these buttons are there on this sheet, altogether?
 
Upvote 0
Re: Help please - how to hide a macro button

It should also have given us a sheet name.
What's the WHOLE string, when that code's run?

The other question I'd asked in my previous post was, "Where is this procedure held?" i.e. in the sheet's code module, in a module, or in "This Workbook"?

New question to add to those two, how many of these buttons are there on this sheet, altogether?

The sheet name is called 'Dashboard'

That's all the text that was returned when I ran that code, there was nothing else?

My vba for the button I'm trying to hide is in Module 8

There are only 3 command buttons that I'm using and showing on my worksheet 'Dashboard'

Does this help? Thanks for continuing to try and help me here
 
Upvote 0
Re: Help please - how to hide a macro button

I would rather use ActiveX but they've never worked for me for some reason

They're notoriously unstable. If you can possibly avoid using them, you should.
 
Upvote 0
Re: Help please - how to hide a macro button

Right...
Can you run this in your module 8 - ensuring that "Dashboard" is the active sheet, before doing so:
Code:
Sub btn_names()

Dim shp As Shape
Dim str As String
Dim sht_name As String

sht_name = ActiveSheet.Name


      For Each shp In ActiveSheet.Shapes
        With shp
          If .Type = msoFormControl And .FormControlType = 0 Then
            str = str & Chr(10) & vbTab & shp.Name & vbTab & vbTab & shp.AlternativeText
          End If
        End With
      Next shp
    
    
MsgBox "Avtivesheet is called: " & sht_name & Chr(10) & "Formcontrol buttons found in the activesheet:" & Chr(10) & vbTab & "NAME " & vbTab & vbTab & " CAPTION " & str
End Sub
This should give us the definitive button names, along with their respective captions.
Please report back.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top