Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hello All
Anyone know how to lock cells using VBA, also unlock others currently locked. Page protection will be in use at the time this needs to be done. Also, is there anywhere on the net with a complete list of VBA functions, including a short statement of what each one does, with or without examples. If not, any good books that cover the above area. I'm really (strange as it might seem), enjoying playing with VBA and seeing exactly what it can do. Regards Peter |
#2
![]() |
|||
|
|||
![]()
The easy questions...
Excel's Help is a very good source. take a look at Peter Nonely's workbook that describes lots of functions: http://homepage.ntlworld.com/noneley/ Peter's site isn't working, but Ron deBruin has a copy at: http://www.rondebruin.nl/files/xlfdic01.zip Debra Dalgleish has some of Norman Harker's files at: http://www.contextures.com/functions.html Debra also has a list of books: http://www.contextures.com/xlbooks.html Lot's of people swear by John Walkenbach's books. ======= You can record a macro in excel when you do this kind of stuff. Turn on the macro recorder: tools|macro|record new macro unprotect the worksheet change a cell from Locked to unlocked and a different cell from unlocked to locked. reprotect the workbook. stop the recorder. Inspect/generalize the code... this was my recorded code: Option Explicit Sub Macro1() ActiveSheet.Unprotect Selection.Locked = True Selection.FormulaHidden = False Range("A24").Select Selection.Locked = False Selection.FormulaHidden = False ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End Sub Notice that the recorder doesn't display the passwords you entered. One way of modifying the code is: Option Explicit Sub Macro1A ActiveSheet.Unprotect password:="hi" range("a1").Locked = True range("a24").locked = false ActiveSheet.Protect password:="hi",DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub But it would really depend on what cells are being locked/unlocked. Peter wrote: Hello All Anyone know how to lock cells using VBA, also unlock others currently locked. Page protection will be in use at the time this needs to be done. Also, is there anywhere on the net with a complete list of VBA functions, including a short statement of what each one does, with or without examples. If not, any good books that cover the above area. I'm really (strange as it might seem), enjoying playing with VBA and seeing exactly what it can do. Regards Peter -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert data type of cells to Text,Number,Date and Time | Excel Worksheet Functions | |||
To safety merge cells without data destroyed, and smart unmerge! | Excel Discussion (Misc queries) | |||
Heps to design Locked/Unlocked cells in protected worksheet | Excel Discussion (Misc queries) | |||
Convert data of cells to any type: Number, Date&Time, Text | Excel Discussion (Misc queries) | |||
Can a cell be locked to prevent being typed over? | Excel Worksheet Functions |