ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ShowDataForm how to lock a field ? (https://www.excelbanter.com/excel-programming/314872-showdataform-how-lock-field.html)

rony

ShowDataForm how to lock a field ?
 

Hello all ,

I want to prompt the user a form in which on of the field is disable meaning
locked.
so I will seen as form like a drop list where the user could insert data
according to one field that is locked.
where
"testRight" is the sub range of fields that I want to remain locked
"testLeft" is the sub range of fields that I want to remain locked
"SubForm" the hole form which includes the headings
"testAll " is the range of all the form I want to deal with


for example I got this code :


Sub Macro5()
'
' Macro5 Macro
' Macro recorded 27/10/2004 by rony
'
' Keyboard Shortcut: Ctrl+r
'
Dim rngDatabaseForUserForm As Excel.Range




ActiveSheet.Unprotect
With ActiveSheet.Range("testRight")
.Locked = False
End With
Selection.FormulaHidden = False
With ActiveSheet.Range("SubTest")

.Interior.ColorIndex = 45
.Interior.Pattern = xlSolid
.Interior.PatternColorIndex = xlAutomatic
End With

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True



Set rngDatabaseForUserForm = ActiveSheet.Range("SubTest_UserForm")

rngDatabaseForUserForm.Name = "Database"


ActiveSheet.ShowDataForm

ActiveSheet.Unprotect
With ActiveSheet.Range("testRight")

.Locked = True
.FormulaHidden = False
End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub





can any one help me with this ??



Rony










All times are GMT +1. The time now is 12:15 PM.

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