I am trying to create an invoice sheet for my computer shop. I have never used excel really unless it was created for me.
My issue is that I want to lock a couple of cells after data is entered for example cells B13, C13, and H13 on sheet2 and so on.
I tried creating a macro
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myRange As Range
On Error Resume Next
Set myRange = Intersect(Range("C13,B13,H13"), Target)
If Not myRange Is Nothing Then
Me.Unprotect
Target.Cells.Locked = True
Me.Protect
End If
End Sub
But it then locks all after the first one is entered. How can I set them to lock after only they are filled?
Per the rule you agreed to follow, all VBA code must be wrapped in code tags.
[code]
your code
[/code]
You cross posted at Ozgrid. This is one of the more serious violations of the forums rules.
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks