problem command button

bam12

Well-known Member
Joined
Dec 6, 2004
Messages
983
i made a command button from the control toolbox
put code in it
and not i cant edit it
it like it is protected

any idea how to fix this
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,357
Office Version
  1. 365
Platform
  1. Windows
Can't edit what?

The code or the button?

If it's the button then the problem is probably that you aren't in design mode.

To enter design mode click the set square in the top left on the Control Toolbox toolbar.
 

bam12

Well-known Member
Joined
Dec 6, 2004
Messages
983
button

i can edit buton
i am in edit mode
when i place cursor over the button i get circle with line thru it

also in edit mode everything is ghosted
 

bam12

Well-known Member
Joined
Dec 6, 2004
Messages
983
Code:
Private Sub CommandButton1_Click()

    Sheets(Array("Summary", "Completed")).Select
    Sheets("Summary").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

End Sub

Here is the code i have. it seems when I run the macro by clicking on the command button it act if it protected the worksheet, causing the above mentioned problem.

I can fix it by clicking on another worksheet and coming back to the one with the command button in it and it is ok.

Could it because I am missing something in code?

Thnaks for any help
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Why not just

Code:
Private Sub CommandButton1_Click()
    Sheets("Summary").PrintOut Copies:=1, Collate:=True
End Sub
 

bam12

Well-known Member
Joined
Dec 6, 2004
Messages
983
more sheets

i have 7 worksheets in the workbook but only print 2 of them,

summary and completed
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Code:
Private Sub CommandButton1_Click()
    Sheets(Array("Summary", "Completed")).PrintOut
End Sub
 

Forum statistics

Threads
1,181,605
Messages
5,930,850
Members
436,764
Latest member
avalladarez

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
Top