Matt Miller
asked on
Password Protect Individual Columns in Excel w/ VBA
Is there a way to password protect active cell individual columns with VBA?
No, as far as I know you cannot password protect one cell or one column
Sure you can. The sheet must be protected but if you do this but by default only things that are locked will be effected, so then do this.
Columns("C:C").Select
Selection.Locked = True
Actually there's no need to Select, so...
Columns("C:C").Locked = True
Martin that locks it, but can you password protect it as Matt asked? I do not know of way for doing that
With ActiveSheet
.Columns("C:C").Locked = True
.Protect Password:="My password"
End With
ASKER
Is there a way to password protect a relative reference?
Is there a way to password protect a relative reference?Please give me an example of what you mean.
ASKER
For example
Do while ActiveCell.value = "" = false
If Activecell.interior.color = red then
Protect column
End if
ActiveCell.offset(1,0).sel ect
Loop
Do while ActiveCell.value = "" = false
If Activecell.interior.color = red then
Protect column
End if
ActiveCell.offset(1,0).sel
Loop
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thx. I ended up going with with
ActiveCell.Columns("A:A"). EntireColu mn.Locked = True
then closing the loop with the ActiveSheet.protect.
The password I will incorporate into my macro (Didn't know you could do that)
ActiveCell.Columns("A:A").
then closing the loop with the ActiveSheet.protect.
The password I will incorporate into my macro (Didn't know you could do that)
You're welcome and I'm glad I was able to help.
Marty - MVP 2009 to 2013
Marty - MVP 2009 to 2013