-
Locking blank cells only via VBA
Public Sub Lock_Blanks()
Dim objCell As Range
ActiveSheet.Unprotect ""
On Error Resume Next
ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).Locked = True
ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas).Locked = True
On Error GoTo 0
ActiveSheet.Protect ""
End Sub
Hi experts
i cannot amend the above to lock blank cells only any pointer for the non VBa person.
thanks
-
Why not lock eveything first, then unlock?
[VBA]
ActiveSheet.Cells.Locked = True
ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).Locked = False
ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas).Locked = False
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules