Linking commandbutton to existing Command Button VBA code

Simmo1313

New Member
Joined
May 4, 2015
Messages
39
Hi all,

I have a workbook that when sent from an apple computer back to me on desktop version lost all functionality of the command button. My aim is to try restore the original functionality of this button.

All the code is still in the original sheet code but the button no longer links to it as I think it became a form button instead of command.

I have insert a new command button and it is named the same as in the sheets source code but it still does not click.

When I look at the button in the formula cell it displays =EMBED("Forms.CommandButton.1","")

Is there a way I need to link this button back to the source code shown below. Is it in the formula above or do I need to change the command buttons properties somewhere?


Private Sub CommandButton3_Click() ' Log out
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim sh As Worksheet
For Each sh In Sheets
If sh.Name <> "Main" Then
sh.Visible = xlSheetVeryHidden
End If
Next sh
Sheet1.Range("b4") = "Select a Name"
Sheet1.Range("b6") = ClearContents
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

Many thanks
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Go to:

Developer >
Design View >
Right Click Button >
View Code >

Is the code what you expect?

You can also double click the button in design view and it should drill to the appropriate code....

You need to makes sure the button is linked to the correct code.

Once you have drilled to the code. You can paste you sub procedure into the click event in order to make it work correctly again....


Example:

Code:
[COLOR=#0000ff]Private Sub [/COLOR][COLOR=#000000]CommandButton1_Click()[/COLOR][COLOR=#0000ff]
[/COLOR][COLOR=#008000]
'Your Code Goes Here[/COLOR][COLOR=#0000ff]
[/COLOR]
[COLOR=#0000ff]
[/COLOR]
[COLOR=#0000ff]End Sub[/COLOR]


I have worked with people using Mas in my office. This alone should have no effect on the workbook.... unless they have altered it.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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