Lock

B

bgkgmg

A1 is invoice number that I would enter. The following cells contain these
invoices E1 = 101, G1 = 102, I1 = 103, etc...
A4, B3, B5, C6 is information that I enter corresponding to invoice # that I
entered in A1. If the invoice # that I enter in A1 is 101 then the info that
I entered in A4,B3,B5,C6 are copied to corresponding invoice which is E1
therfore cells F1,F2,F3,F4. If the invoice # I enter is 102 then the info is
copied to H1,H2,H3,H4. Etc with 103,104..... When the invoice 101 is copied
to F1:F4 I want
F1:F4 to be locked so numbers cannot be changed and so on. I have locked
the cells in F1-4 and H1-4 and have the the sheet unprotected. The code I
now have is locking both F1-4 and H1-4 after completing just invoice 101. It
reads:
Private Sub CommandButton1_Click()
If Range("A1").Value = Range("E1") Then
Range("F1").Value = Range("A4").Value
Range("F2").Value = Range("B5").Value
Range("F3").Value = Range("C6").Value
Range("F4").Value = Range("B3").Value
Range("A4").Value = ""
Range("B5").Value = ""
Range("C6").Value = ""
Range("B3").Value = ""
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

End If
If Range("A1").Value = Range("G1") Then
Range("H1").Value = Range("A4").Value
Range("H2").Value = Range("B5").Value
Range("H3").Value = Range("C6").Value
Range("H4").Value = Range("B3").Value
Range("A4").Value = ""
Range("B5").Value = ""
Range("C6").Value = ""
Range("B3").Value = ""
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True


I hope my question is clear
End If
End Sub

Any help would be appreciated.
Thanks
Bobby
 

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