Hi
Basically I want a worksheet to become read only, is there any way of implementing this?
Hi
Basically I want a worksheet to become read only, is there any way of implementing this?
To make a worksheet read only you would need to make sure cells are locked and then apply worksheet protection, however to make a workbook read only you could use this:
[VBA]
Private Sub Workbook_Open()
ThisWorkbook.ChangeFileAccess xlReadOnly
End Sub
[/VBA]then everytime your workbook is opened it will be read only!
Regards,
SImon
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
worksheet -> WorkBook.Originally Posted by bopo
[VBA]Set WB = Workbooks.Open("C:\FolderName\WorkBookName.xls", False, True)[/VBA]
M.Aytaş
For worksheets:
[vba]Worksheets("Sheet1").Protect Password:="MyPassword", userinterfaceonly:=True[/vba]
Change the sheet name (or put it in a loop), and change the password or elminate it all together. The UserInterfaceOnly argument sets it to allow macros to run on the worksheet, but prevent users from editing "locked" fields.
Be warned that the UserInterfaceOnly setting does not persist when Excel is closed. If you want that feature, I'd suggest a routine called from your Workbook_Open routine that re-protects the applicable sheets.
HTH,
Ken Puls, CMA - Microsoft MVP (Excel)
I hate it when my computer does what I tell it to, and not what I want it to.
Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar
This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!
Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!