ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with macro!! (https://www.excelbanter.com/excel-programming/291204-re-help-macro.html)

nrage21[_30_]

Help with macro!!
 
How do I protect this cells when an user clicks the commandbutton?


Private Sub Commandbutton_Click()
If Range("E7") < "" And Range("F7") < "" And Range("G7) "" Then
ActiveWorkbook.Save
Else
MsgBox "Unable to book! Complete ALL Fields"
End If
End Sub


I Tried... Range("E7").Locked = True.... but I'm not getting th
expected outcome. Any ideas?

- Larry -
VBA Amateu

--
Message posted from http://www.ExcelForum.com


nrage21[_31_]

Help with macro!!
 
Nevermind! I Got it

ActiveSheet.Unprotect
Range("E7").Locked = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True

- Larry -
VBA Amateu

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com