ShowDataForm how to lock a field ?

R

rony

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top