The Cove Business Standards Discussion Forums More Free Files Forum Discussion Thread Post Attachments Listing Cove Discussion Forums Main Page
UL - Underwriters Laboratories - Health Sciences
Go Back   The Elsmar Cove Quality Assurance Discussion Forums > Common Quality Assurance Processes and Tools > Quality Tools, Improvement and Analysis > Quality Assurance and Compliance Software Tools / Solutions > Excel .xls Spreadsheet Templates and Tools
Forum Username

Elsmar Cove Forum Visitor Notice(s)

Wooden Line

VBA Needed to Protect Individual Excel Cells


Monitor the Elsmar Forum
Sponsor Links



Courtesy Quick Links

Links that Cove visitors will find useful in your quest for knowledge:


ASQ - American Society for Quality

International Standards Organization - ISO Standards and Information

Howard's
International Quality Services

Marcelo Antunes'
SQR Consulting, and
Medical Devices Expert Forum

Bob Doering's
Correct SPC - Precision Machining

NIST's Engineering Statistics Handbook

IRCA - International Register of Certified Auditors

SAE - Society of Automotive Engineers

Quality Digest

IEST - Institute of Environmental Sciences and Technology


LinkedIn Groups

ISO 9001 for Small Businesses

Information Security Community

Medical Devices Group

Quality and Regulatory Network

AS91XX Series - Tips and Advice

FDA (Food and Drugs)


Related Topic Tags
microsoft excel .xls .xlsx spreadsheet
Reply
 
Thread Tools Search this Thread Rate Thread Content Display Modes
  Post Number #1  
Old 28th April 2012, 03:37 PM
124McNaughton

 
 
Total Posts: 7
Please Help! VBA Needed to Protect Individual Excel Cells

I am trying to create an approval button for my manager that will show the date of the approval and his name along with protecting the cells so they cannot be changed. He would also like the protected cells to be password protected. So far I have a short VBA program that will enter his name and the date he approved the work. I am stuck on the protection aspect of the program, the best that I can do is protect the entire work sheet not the individual cell with a password. I have included the VBA program that I have developed so far.
Any help would be greatly appreciated.

Private Sub ApprovelButton1_Click()
With ActiveSheet
.Unprotect
.Cells(7, 5) = Date
.Cells(7, 6) = "John Doe"
.Protect
End With
End Sub


Thanks in Advanced.

Sponsored Links
  Post Number #2  
Old 28th April 2012, 09:22 PM
michaelrm's Avatar
michaelrm

 
 
Total Posts: 45
Re: VBA Needed to Protect Individual Excel Cells

try this

Sub ProtectTheSheet()
Cells.Locked = False
Range("A3:A12,D3:E12,J1:R13,W18").Locked = True
ActiveSheet.protect
End Sub
Sponsored Links

  Post Number #3  
Old 29th April 2012, 12:23 AM
Hodgepodge's Avatar
Hodgepodge

 
 
Total Posts: 281
Re: VBA Needed to Protect Individual Excel Cells

Assign this macro to your button.

Code:
Sub Rectangle2_Click()
    With ActiveSheet
        .Unprotect Password:="Banana2000"
        .Cells(7, 5) = Date
        .Cells(7, 6) = "John Doe"
        .Cells.Locked = False
        .Range("E7:F7").Locked = True
        .Protect Password:="Banana2000"
    End With
End Sub
See the attachment for an example. I wouldn't normally use "Range" & "Cells" in the same code. I just put it in there the different methods in case others feel more comfortable with one method or the other.
Attached Files: 1. Scan for viruses before using, 2. Please report any 'bad' files by Reporting this post, 3. Use at your Own Risk.
File Type: xlsm Protect Cells Research.xlsm (18.4 KB, 56 views)
Thanks to Hodgepodge for your informative Post and/or Attachment!
Reply

Lower Navigation Bar
Go Back   The Elsmar Cove Quality Assurance Discussion Forums > Common Quality Assurance Processes and Tools > Quality Tools, Improvement and Analysis > Quality Assurance and Compliance Software Tools / Solutions > Excel .xls Spreadsheet Templates and Tools

Bookmarks


Visitors Currently Viewing this Thread: 1 (0 Registered Visitors (Members) and 1 Unregistered Guest Visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Forum Search
Display Modes Rate Thread Content
Rate Thread Content:

Forum Posting Settings
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Discussion Threads
Discussion Thread Title Thread Starter Forum Replies Last Post or Poll Vote
Use of Excel and VBA (visual basic for applications) in quality systems mclau152 Excel .xls Spreadsheet Templates and Tools 3 4th June 2015 04:14 PM
How do I autofill cell color based on other cells' color in Excel? Kchatzi Excel .xls Spreadsheet Templates and Tools 6 9th January 2013 06:23 AM
Controlling Minitab by vba (visual basic) or vb Inspector-71 Using Minitab Software 6 25th April 2012 05:52 AM
Individual/Moving Range Chart (IMR Chart) in Excel amroczek Excel .xls Spreadsheet Templates and Tools 8 1st February 2012 06:45 AM
Free Introduction Course - VBA (Visual Basic for Application) in Excel to make forms jrubio Excel .xls Spreadsheet Templates and Tools 10 30th May 2008 04:48 PM



The time now is 08:58 PM. All times are GMT -4.
Your time zone can be changed in your UserCP --> Options.


 


NOTE: This forum uses "Cookies" -- The Elsmar Cove is *Copyright Free*.