excel+courses - macros

AI Training: For Busy Decision Makers & Professionals Book now

Forum home » Delegate support and help forum » Microsoft Excel Training and help » excel+courses - Macros

excel+courses - Macros

resolvedResolved · Low Priority · Version Standard

peter has attended:
Excel Advanced course

Macros

can single macro apply to all worksheets of a workbook without activating for each worksheet. i.e. activate once for entire workbook

RE: macros

Hi Peter,

Thanks for your question. I have asked my colleague who does VBA to address this question, and will get back to you.

Rehards

Richard

RE: macros

Hi Peter

Try using this peice of VBA in a new module of the VBA editor.
It will set the password to 123, which you can change by simply editing the code below.

You can add your own macro buttons to your excel toolbar, and assign each macro.

I have also attached the example sheet so you can see it in action.

Regards

Richard

------------
Option Explicit
Sub Protectsheets()
Dim wsheet As Worksheet

For Each wsheet In ActiveWorkbook.Worksheets
wsheet.Protect password:="123"

Next wsheet

End Sub


Sub unprotectsheet()
Dim wsheet As Worksheet
Dim password As String
password = InputBox("Please enter the password")

For Each wsheet In ActiveWorkbook.Worksheets
wsheet.Unprotect password:=password

-------

Attached files...

protectallsheets.xls

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Conditional Formatting in Excel 2010

If you have lots of data in a spreadsheet, you may find that it is easier to read if you highlight some of the values. This is Conditional Formatting and here's how to use it:

1) Select the data you wish to apply the format to and click Conditional Formatting
2) A list of options will then appear, from this list, choose the format you wish to display e.g. find all cells with a value less than 0
3) Excel will then highlight all of these cells

To remove this: select the highlighted cells, click the drop down on the Conditional Formatting icon and select Clear Rules from selected cells.

View all Excel hints and tips


Server loaded in 0.12 secs.