excel+courses - macros
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

excel+courses - Macros

resolvedResolved · Low Priority · Version Standard

replyReply Thu 6 Dec 2007, 16:54Delegate peter said...

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

For upcoming training course dates see: Pricing & availability

replyReply Mon 10 Dec 2007, 10:07Trainer Richard said...

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

replyReply Mon 10 Dec 2007, 10:54Trainer Richard said...

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

 

Excel tip:

Create a hyperlink navigation sheet

In large files, it is often useful to have a front sheet with hyperlinks to the key databases and summary calculations in your spreadsheet. Hyperlinks can save you and (more importantly) those less familiar with your spreadsheet a great deal of pointless scrolling between and within sheets.



Hyperlinks appear as underlined text and can jump to any cell or range name in your file. You can also use hyperlinks to jump to other files.



To create a hyperlink to a location in the active workbook: (1) Select the cell that contains the text you want to use as the hyperlink and choose Insert|Hyperlink.(2)Click Place in this document.(3)Choose the sheet you want to link to or the range name from the list of "Defined Names".(4)If necessary, type the cell reference in the Type in the cell reference box. (5) Click OK.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard